Skip to content

Instantly share code, notes, and snippets.

@dbernar1
Last active August 29, 2015 14:04
Show Gist options
  • Save dbernar1/3d0af36978226b59cd80 to your computer and use it in GitHub Desktop.
Save dbernar1/3d0af36978226b59cd80 to your computer and use it in GitHub Desktop.
Content from another site
<?php
function get_permalink__dbernar1( $post = null ) {
if ( is_null( $post ) ) global $post;
return site_url( 'products/' . $post->post_name );
}
add_action( 'init', '_fbc_create_agcanada_post_types_rewrite_rules' );
function _reate_aost_types_rewrite_rules(__dbernar1) {
global $_FBC_AGCANADA_POST_TYPES;
// add_rewrite_tag( '%video%', '([^&]+)' );
foreach( $_FBC_AGCANADA_POST_TYPES as $slug => $post_type_data ) {
add_rewrite_tag( '%' . $post_type_data[ 'query_var' ] . '%', '([^&]+)' );
if ( $post_type_data[ 'has_archive' ] ) {
add_rewrite_rule( '^' . $post_type_data[ 'url_slug' ] . '/?$', 'index.php?' . $post_type_data[ 'query_var' ] . '=archive', 'top' );
add_rewrite_rule( '^' . $post_type_data[ 'url_slug' ] . '/page/(\d++)/?$', 'index.php?' . $post_type_data[ 'query_var' ] . '=archive&paged=$matches[1]', 'top' );
}
add_rewrite_rule( '^' . $post_type_data[ 'url_slug' ] . '/([^/]*)/?', 'index.php?' . $post_type_data[ 'query_var' ] . '=$matches[1]', 'top' );
}
}
@dbernar1
Copy link
Author

This is missing other pieces to actually be a whole solution, I created it to fill in the blanks of a guy who was already partway there.

Get in touch ( in a way listed at http://gravatar.com/dbernar1 ) if you need more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment