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 15 posts - 16 through 30 (of 40 total)
  • Author
    Posts
  • #11369

    dwogahn
    Participant
    Post count: 18

    Thanks wpsmith. I was able to follow these instructions.

    In Theme Settings I can choose between “Display post excerpts” OR “Display post content”. Is there a way to assign this option by category? i.e. I’d like only one category to “Display post content” and all other categories to “Display post excerpts”.

    #11374

    Bill Murray
    Participant
    Post count: 575

    The answer to your question goes back to some of my earlier comments. You can do what you want, but it will take a little more effort.

    With the standard options, you cannot have a different archive setting by category. With the standard options, all archives follow the setting for content/excerpt. However, in WP, you can create templates, and you can control the display and styling of every category individually with a category template. See the WP codex on category templates. As wpsmith observed, some of the elements of category templates are available to you in other ways, such as the title and category description, which you can control on a category by category basis. But unfortunately, control of post content vs excerpts only comes from a category template.

    A category template is a very small file that you’d put in your child theme folder. Google (or just search here) to locate some examples that might suit your needs, and we can suggest ways to fine tune those templates for you. I have a number of them already, but without a better sense of what you want in a category template, they wouldn’t get you closer to where you want to go.


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

    We do managed WordPress hosting.

    #11383

    wpsmith
    Moderator
    Post count: 178

    If you only want one category that you’d like to display all content, I would set the setting for excerpts. Then in functions.php, I would write up some code to display the full content of the other category. However, just as Bill noted, without knowing further where and when you’d like to do this, we cannot give you the best code.


    Travis Smith | Recommended StudioPress Developer & Contributor
    WP Smith | @wp_smith | GitHub

    Due to the forums, please paste code using Pastebin, JS Fiddle (for JavaScript) or GitHub.
    How to use Firebug for Designers by SixRevisions

    #11977

    dwogahn
    Participant
    Post count: 18

    I read through the relevant codex (thanks Bill) which helped me understand your suggestion better wpsmith. I also poked around the discussion boards before coming up with what I hope is a clearer idea of what I’m after.
    I want to display all categories EXCEPT one category (my #35) as post excerpt. Right now I have the image default as 300×300 and I can leave it that way.
    The exception category is my #35. As I understand it this would be a new category template. Here is the look and behavior I’d like to achieve:

    No date, no author, no comments
    300×300 image
    Text from full post
    I currently show social media tools below each post. I’d like to continue to offer this, if possible.
    The post can link to the “full post” although it would look exactly the same.
    I’d like to have Category header text. I prefer to show text at the top of the category on the first page only, if possible.

    Do one of you have something like this you can share? Or some specific direction? Or compromises that get me close? Thanks in advance.

    #12011

    Bill Murray
    Participant
    Post count: 575

    See http://wpp.im/a.

    To exclude 1 category from your blog archive, see the info in this thread. Adjust your blog archive for your desired outcome.

    For your category template for category with an ID of 35, put the code in the template in a file named category-35.php

    The template displays 5 full posts, but you can adjust that. As for comments, they don’t display in an archive. If you don’t want to allow visitors to comment on a post in this category, you can manually turn that off on the post edit screen.

    That should be pretty close to what you described. Hope it helps.


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

    We do managed WordPress hosting.

    #12096

    dwogahn
    Participant
    Post count: 18

    Bill, this is great! Thanks! One tiny thing is that it is adding a second image in category view….perhaps b/c I noted in my instructions that i wanted to keep the 300×300 image. I should have said that I want the default 300×300 only. This image is an affiliate link. How do I show only the image with the Aff link?

    I’ve left it “broken” on my site for now so you can see: http://www.sellbox.com/category/project-gallery

    Thanks.

    #12113

    Bill Murray
    Participant
    Post count: 575

    I’m guessing you put an image in the post content with an affiliate link. That’s fine. However, there is a separate image that can be controlled in the archive. The image from the archive can be easily removed with the PHP code below:

    [php]
    remove_action(‘genesis_post_content’, ‘genesis_do_post_image’);
    [/php]

    The image in the post content is harder to remove automatically. That means if you opt for the easy way out now by adding that line, you’ll have a hard time if you ever want a content archive for this category without the image. On the other hand, if you want to put in more time to preserve future flexibility, you can add your affiliate links to each image in your media library for this category. Then, after testing 1 image and confirming the affiliate link works, edit 1 post to remove the image from the post content. If you’re happy with the result, edit the rest of the posts. That should leave you with 1 image on your archive for this category which will be easy to remove if you decide to alter the category presentation.


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

    We do managed WordPress hosting.

    #12135

    dwogahn
    Participant
    Post count: 18

    Having a little trouble with this. For code placement, am I to add this in the file category-X.php along with the other remove_action lines? Seems so but just confirming.

    I’ll likely opt to keep things flexible for the future but I’m getting stuck. I think its basic WP stuff.

    “…you can add your affiliate links to each image in your media library for this category. “

    When I go to Media Library, find the image, I don’t see a place to add the affiliate link. I must be missing something. I used Upload/Insert to add the image and dropped the affiliate code in there. This is the one you say to delete, I believe.

    #12176

    Bill Murray
    Participant
    Post count: 575

    1) Yes, add it with the other remove_action lines. Order shouldn’t matter.

    2) My error. Sorry. I can barely tolerate WP’s media library, but sometimes I’m in a generous mood and give it more credit than it deserves. This is one of those cases where that led me to giving you bad info. WP only allows you to specify the Link URL when you insert an image into a page/post as you’ve done, and that’s how you set up your affiliate link. Because of that limitation, you can’t have the flexibility that I outlined. Therefore, you should just leave the posts as they are (less work!) and add that remove_action to the category template. That should remove the 1st image, which is not the affiliate link, leaving you with 1 image, which is the 1 you want.


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

    We do managed WordPress hosting.

    #12183

    dwogahn
    Participant
    Post count: 18

    Added without problem. I kept your cautionary notes in my changes file just in case that becomes an issue in the future. I think this resolves my current need. Batman, should I need you again, how shall I find you?

    #12228

    Bill Murray
    Participant
    Post count: 575

    Glad it worked for you. I wander around these forums as time permits. Among other things, I run a performance-oriented managed WP hosting environment where you can get ticket-based email support for customizations like this. In setting that up, I’ve learned a lot from the WP community, so as time permits I try to answer a few questions at different forums like this as a way of helping to build that community. Unfortunately, there are never enough hours in the day.


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

    We do managed WordPress hosting.

    #12357

    dwogahn
    Participant
    Post count: 18
    This reply has been marked as private.
    #12378

    Bill Murray
    Participant
    Post count: 575

    If you were intending that I would see your last comment, you marked it as private, so it’s only available to moderators, and I’m not a moderator. I’ve seen this elsewhere in the forum, and I think participants imagine that the reply is private to the previous responder, but that’s not how it works.


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

    We do managed WordPress hosting.

    #13069

    dwogahn
    Participant
    Post count: 18

    I’m back with a couple odd problems. Excluding a category ID in Theme Settings doesn’t seem to work. Right now I have it set to exclude my #35 (Project Gallery).

    I added a file called category-35.php per the above post (#12011). This is set to show 5 full posts at a time. I currently have 49 posts in category 35. When set for 5, I get a 404 error when I click forward to page 7. So, the first 5×6 posts show (30) but that’s it. (The same thing happens if I set it to 4 only I can’t get to page 8.) If I edit the php file to display 7  posts per page I can page forward through all posts. Same thing if I set it to 8 posts per page.

    Right now I have it set to display 6 posts which works until page 7. Page 8 and forward results in a 404.

    #13077

    Bill Murray
    Participant
    Post count: 575

    On the 2 issues…

    1) Excluding the category via theme settings: This only works when using the blog template. So other WP loops aren’t affected. To get around that, you can use the code from this Gist. You’d add that to your child theme’s functions.php but remove the opening PHP tag in the Gist, as your functions.php already has one.

    2) My template was a “quickie”, and I didn’t mention a limitation inherent in the method I choose (only for speed of typing). If your posts per page in WP Settings->Reading is above the posts in this template, you will see this behavior. However, now that I have a better handle on what you want, I can adjust the template using a different method to query posts. Hopefully, I’ll some free time this weekend.


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

    We do managed WordPress hosting.

Viewing 15 posts - 16 through 30 (of 40 total)

You must be logged in to reply to this topic.