Seeking plugin/code to maintain 2 sets of posts

Community Forums Forums General Discussion Seeking plugin/code to maintain 2 sets of posts

This topic is: not resolved

This topic contains 39 replies, has 4 voices, and was last updated by  dwogahn 1 year, 7 months ago.

Viewing 10 posts - 31 through 40 (of 40 total)
  • Author
    Posts
  • #13138

    Bill Murray
    Participant
    Post count: 575

    Weird forum behavior. I just made a post with the changes you need to make, but it’s not displaying. Unfortunately, I don’t have the time just now to re-type it, but I’ll check back later this weekend.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #13171

    Bill Murray
    Participant
    Post count: 575

    Here are the adjustments that should a) resolve the 404 error, b) fix the pagination, and c) remove category 35 from your home page loop. First, remove the category exclusion from your theme settings. Next, make sure your have a working backup of your child theme functions.php and FTP access to your site. This involves edits to that file, which if done incorrectly, can break your site. You can quickly fix that by deleting the bad functions.php and copying the good one in its place. Only attempt this if you’re comfortable doing it and can fix something if it breaks.

    1. Revise your custom category template to this:

    [php]
    <?php
    /*
    Category template for Genesis framework to display 5 full posts
    Author: wpPERFORM.com

    To use, put a copy in child theme folder and rename to category-xx.php where xx is replaced by the numeric ID of the category to which the template applies.

    */

    remove_action(‘genesis_post_content’, ‘genesis_do_content’);
    remove_action(‘genesis_post_content’, ‘genesis_do_post_content’);
    remove_action(‘genesis_before_post_content’, ‘genesis_post_info’);
    remove_action(‘genesis_after_post_content’, ‘genesis_post_meta’);

    add_action(‘genesis_post_content’, ‘custom_content_limit’);
    function custom_content_limit() {
    the_content();
    }

    genesis();
    [/php]

    2. Edit your child theme’s functions.php to add this code near the bottom, before any closing tag (if one exists):

    [php]
    // credit to Bill Erickson, see http://www.billerickson.net/customize-the-wordpress-query/
    // excludes category 35 from home page main query
    add_action( ‘pre_get_posts’, ‘be_exclude_category_from_blog’ );
    function be_exclude_category_from_blog( $query ) {
    if( $query->is_main_query() && $query->is_home() ) {
    $query->set( ‘cat’, ‘-35′ );
    }
    }

    // sets 5 posts per page for category 35
    add_action( ‘pre_get_posts’, ‘wpp_child_before_loop’ );
    function wpp_child_before_loop ( $query ) {
    if( $query->is_main_query() && !is_admin() && is_category( ’35′ ) ) {
    $query->set( ‘posts_per_page’, ’5′ );
    }
    }
    [/php]


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #13662

    dwogahn
    Participant
    Post count: 18

    Thanks Bill. I removed the category exclusion and did the back and got the following error after making the change:

    Server error
    The website encountered an error while retrieving http://www.sellbox.com/wp-admin/theme-editor.php?file=functions.php&theme=education&scrollto=1400&updated=true. It may be down for maintenance or configured incorrectly.
    Here are some suggestions:
    Reload this webpage later.
    HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

    Note sure if the order matters, meaning, I updated the category-35.php file first, then the functions.php. I set everything back the way it was.

    Let me know if I should check something else.

    #13665

    Bill Murray
    Participant
    Post count: 575

    My previous post has an odd history. After posting it, it didn’t appear, and the next day, I came back to re-post it and it was there, so I suspect the post ended up in a spam queue, and someone rescued it. Looking at the code, it’s not exactly how I posted it.

    On the lines starting with if…, after is_main_query(), there should be 2 ampersands together, not separated by a space, instead of the &#038 followed by a semicolon. In other words, you are replacing each &#038 followed by a semicolon with a single ampersand, so that you have 2 ampersands back to back. It is a total of 6 replacements. Give that a try (again with a working backup), and post back. If that fails, I can post the code and provide a link. The forum software here alters the code, and the post getting flagged as spam didn’t help.

    500 errors are almost always PHP errors, so if those changes aren’t the source of the problem, it could have been a mixup on copy/paste. But if you just copied the code as it appears in my previous post, that’s likely the source of the error.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #14002

    dwogahn
    Participant
    Post count: 18

    It worked! Great instructions. The only thing I needed to do was add the line of code to kill the duplicate image file but we went through that before so it was easily done. Thanks for all your help. I’ll leave this thread open for a few days in case my usage turns anything else up.

    #14003

    Bill Murray
    Participant
    Post count: 575

    Glad it worked for you. You covered a lot of ground in these posts; you’ll be writing custom templates for others in no time.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #14077

    dwogahn
    Participant
    Post count: 18

    Not only did I get a chance to geek out a bit but the exercise gave me some strategy inspiration as well. This thread has been an invaluable education. Thank you.

    #18661

    dwogahn
    Participant
    Post count: 18

    I’ve been assigning tags to all my posts but one category (my project gallery) dominates the tag cloud. Short of deleting the tags associated with posts in this category, are there alternatives? Sub categories?

    #18672

    Bill Murray
    Participant
    Post count: 575

    Are you talking about your site http://www.sellbox.com? If I understand you correctly, you are saying that the tags you put on posts in the My Project Gallery category dominate your tag cloud. That’s just a natural outcome of something such as a) having more posts in that category compared to others, b) having more taggable content in that category, or c) something along those lines. You don’t want tags & categories to completely overlap; otherwise, there would be no point in using 2 taxonomies.

    Categories are normally fewer in number than tags. You’ll want to develop a strategy for how you’ll use categories vs tags. For example, you might have a site where Politics is a category and you could use tags for people & events. Under that scheme, you wouldn’t want to create a category for an event, because tags cover that. Generally speaking, when you see overlap or duplication in categories & tags, it’s an indication that your strategy for using the 2 different taxonomies needs to be better clarified.

    You also have to be careful with tag clouds because they can be resource hogs, especially if you have a lot of tags. A lot of people misunderstand the benefit of tag clouds. They typically do NOT help visitors find content in the traditional sense of searching; after all, any content that you tag with “blue” likely has “blue” in the post content, so a search on your site for “blue” will return that content. Tag clouds help visitors DISCOVER content in that while on your site reading about “apples”, a visitor can discover your content on “blue” because he is drawn to the larger font of the tag in the tag cloud. If you didn’t aid this content discovery, the visitor might leave without ever realizing that you covered more than “apples”. Therefore, your choice of tags has to be guided by what you think will cause your visitors to explore further. If you pay the price of a performance hit from having a tag cloud, you have to get the benefit of longer, deeper visits.

    Btw, since this topic isn’t really related to your original question, you’d benefit from starting a new thread with a good description for this type of question. That would encourage more readership, which might lead to more diverse responses.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #18964

    dwogahn
    Participant
    Post count: 18

    Thanks for the detailed feedback. What I am experiencing is the unintended result of adding and organizing this new collection of content, which is extensive relative to my more editorially driven posts. As a matter of strategy I realize I don’t need to tag this category of posts. In fact subcategories might be even better.

    I originally posted here b/c it relates to using Posts to profile a unique set of content. I’ll keep that in perspective when it comes to using other WP features and widgets.

Viewing 10 posts - 31 through 40 (of 40 total)

You must be logged in to reply to this topic.