ph34r
Forum Replies Created
-
Forum: Hacks
In reply to: CPT with Custom Categorical HierarchySo I got closer to my final desired product by modifying my rewrite rules to the following:
function vidrewrite_rules(){ add_rewrite_rule( '^reviews/([-a-z0-9]+)?$', 'index.php?category_name=$matches[1]', 'top' ); add_rewrite_rule( '^reviews/([-a-z0-9]+)/([-a-z0-9]+)?$', 'index.php?category_name=$matches[2]', 'top' ); }However, now in my loop when I’m retrieving the reviews programatically, the URL’s are not correct, they show as website.com/reviews/test-review instead of the full URL with the categories. Thus, clicking on them results in a 404.
function genesis_page_archive_content() { ?> <ul> <?php wp_list_pages( 'post_type=review' ); ?> </ul> <?php }Forum: Hacks
In reply to: CPT with Custom Categorical Hierarchybcworkz, in my last attempt, I used the built in category taxanomy, and a created a parent and child category. I applied the child category to the review posot. I then wrote the following snippet of code:
/** * Create custom permalink structure for 'Review' pages */ function review_rewrite_rules(){ add_rewrite_tag( '%primary_category%', '([^&]+)' ); add_rewrite_rule( '^reviews/([-a-z0-9]+)/([-a-z0-9]+)?$', 'index.php?post_type=review&primary_category=$matches[1]&review=$matches[2]', 'top' ); add_rewrite_tag( '%secondary_category%', '([^&]+)' ); add_rewrite_rule( '^reviews/([-a-z0-9]+)/([-a-z0-9]+)/([-a-z0-9]+)?$', 'index.php?post_type=review&primary_category=$matches[1]&secondary_category=$matches[2]&review=$matches[3]', 'top' ); } // Register the permalink structure desired for 'Review' posts, with placeholders add_action( 'init', 'review_rewrite_rules' );While this allowed me to navigate to the actual review page correctly (website.com/reviews/parent/child/actual-review), navigating to the category pages resulted in a 404 (website.com/reviews/parent or website.com/reviews/parent/child/). Any ideas on how I can get the the URLs to the categories to work, or is this not the best approach?
Forum: Hacks
In reply to: Custom Post Type with modified permalink structure results in 404Hi Ryan,
Thanks for quick reply back. What I noticed in recreating your steps is that it works fine if only a parent category is selected. However, if a sub category (e.g. test -> testsub) is created and only the sub category is selected, neither link works (reviews/test/post/ nor /reviews/test/sub/post). If the sub category and parent category are selected, then only the top level permalink will work (reviews/test/post, not reviews/test/sub/post).
Any idea on how to address this? In order for everything to work as intended, I really need the subcategory permalink to work, that was the point of the following snippet in my code:
// get full category slug, including parent cat if ( $parent = $cateogryObject->parent ) { $category_link = get_category_parents($parent, false, '/', true) . $category_link; }I know this is doable, because I’m able to achieve it using the “Custom Post Type Permalinks” plugin by Toro_Unit, but I can’t rely on that plugin for this project.
Forum: Hacks
In reply to: Custom Post Type with modified permalink structure results in 404Eggheads, as stated originally, the rewrite rules had already been flushed prior to submitting the request for assistance.
Ryan, did you verbatim copy my code for your test? I am still unable to get the CPT permalinks to function as intended.
Forum: Fixing WordPress
In reply to: SMF forum and WordPress redirectsThanks again for the input. I would love to switch software but I’m dealing with a huge forum integration/migration as part of a rebranding effort and have to stick with SMF. I’ve seen this done before so many times, surely someone must have an idea. I wonder if using dual subdirectories would work and just change wordpress site URL in the panel:
Root:
/wp/
/forums/Forum: Fixing WordPress
In reply to: SMF forum and WordPress redirectsThanks for the quick reply. They aren’t exactly in the same directories though. I meant that within the root are all the wp folders and files along with an additional folder that holds all of the forums files.
Forum: Plugins
In reply to: [W3 Total Cache] 500 Internal Server ErrorThat worked. Thanks a bunch!
Forum: Plugins
In reply to: [W3 Total Cache] 500 Internal Server ErrorNadia,
Thanks for the feedback. I tried the hta access suggestion with no luck. Do you know of any methods to change the URL structure without admin panel access?