Custom Template for Specific Tag

Community Forums Forums General Discussion Custom Template for Specific Tag

This topic is: not resolved

Tagged: ,

This topic contains 10 replies, has 4 voices, and was last updated by  Bill Murray 2 years, 7 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #32031



    I hope someone can help me with custom loop.

    1. I want to create a special page for a specific tag. Let it be tag “special”.
    2. Instead of using the tag archive, I want to create a custom loop and custom template so I can customize the page.

    3. I created special.php, created a new page called “Special” and choose special.php template. These are the code I use in special.php:

    /** Replace the standard loop with our custom loop */
    remove_action( ‘genesis_loop’, ‘genesis_do_loop’ );
     add_action( ‘genesis_loop’, ‘child_do_custom_loop’ );
    function child_do_custom_loop() {
     global $query_args; // any wp_query() args
     $args= array(‘tag’ => ‘special’);
     genesis_custom_loop(wp_parse_args($query_args, $args));
    // Divide the post into 3 columns
    function be_archive_post_class( $classes ) {
     $classes[] = ‘one-third';
     global $wp_query;
     if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % 3 )
     $classes[] = ‘first';
     return $classes;
     add_filter( ‘post_class’, ‘be_archive_post_class’ );

    4. I tested the codes, and the custom loop works fine. However, the function to divide the post into 3 columns bothers me. The posts is divided into 3 columns, but it shrink to the left.



    Ok just figure it out. Nothing is wrong. Just messed up with the other functions/css. Tested with other theme and works perfectly.

    Sorry can’t delete the post.



    As you have just managed to get the result you wanted, could you spare a moment for someone struggling with the same sort of thing, but not a developer and really needing to be hit over the head with the answer?

    I tried to get some help over here [ ] but didn’t really get what I needed.

    I am not a developer, not even a designer, just an integrator, so any help you can give me at alll would be much appreciated.

    My goal is to not use a separate blog page but end up with a structure like this http://domain.tld/page/post/comments/

    I believe I can do this with the Cornerstone plugin ~ [ ] ~ but I can’t figure out on this [ ] alternative loop code how I replace the loop in Genesis with a loop that loads Cornerstone’s post URLs rather than categories.

    Can you help me?



    Bill Murray

    @terence_milbourn – My better judgment says to skip your question because it’s so open-ended, but every now and then I ignore myself, so here goes…

    This thread really has nothing to do with what you want. My advice: skip the plugin to which you linked. That’s not based on using it, only based on the notion that if it’s not pretty straightforward for you to use, it’s probably not a good fit for you. I looked at the link, and I can’t think of any situation where I could ever see using the plugin. The notion of putting posts under pages is really just a variation of either a) category archives or b) creating a page and pulling posts onto that page that match some criteria (category, tag, etc). (b) is something that Genesis does just fine without the plugin, and (a) is the simple way to get page-like content followed by the posts that are connected to it. At its core, that’s what the plugin does, but WP already does it simpler and therefore better.

    On your quest not to use a separate blog page, WP or Genesis don’t make you do that.

    On your desired URL structure: why is that desired or better? Replace “page” with “category” and you can easily do that in WP, no plugin required. You can use Genesis to have category descriptions above your category archive, and you effectively
    have what you’re seeking.

    For comments, your URL’s by default will be /post/#comment-1234, where 1234 is the comment number. That’s not a dead on match for what you asked for, but it’s pretty close.

    If you can articulate a good reason why your structure has value, you might get more takers willing to help you get there, especially from those who’ll benefit themselves. Without a good reason that is effectively communicated, people with the skills to nudge you in the right direction just don’t get excited.

    Hope that helps.

    Web: or Twitter: @wpperform

    We do managed WordPress hosting.




    @Bill_Murray ~ thanks for humoring me… 8^)

    Essentially you are right, but I think its a bit more than just not liking the default WP filtering for posts ~ nobody does, which why every theme seems to d it a little differently ~ Genesis for example.

    WordPress is great for blogging ~ displaying sequential pages of chronologically-ordered posts. That’s what it was built for. But what if you want to build a site with other sections as well ~ a site with structure?

    One of the most common workarounds is to use categories to create the illusion of a structure for your site. Categories can be hierarchically organized, and you can include a link to a category archive page in your navigation so that it looks like it’s an actual section on the site and the archive page will list all posts in that category.

    There’s a huge SEO payload if its married to a “cornerstone” content creation/management strategy and if done correctly.

    There’s no point in me repeating it because its all been written by the Cornerstone author ~ Posts in Sections in WordPress with Cornerstone ~ and Derek Halpern on CopyBlogger ~ How Cornerstone Content Gets You Traffic and Subscriber.

    First, I read this article by the author of Cornerstone (vested interest, of course) ~ 5 Reasons Why You Should Never Use Categories for Site Structure in WordPress ~ but, even so, it made sense to me.

    So with with Cornerstone taking care of the permalink structure with ~ /%postpath%/%postname%/ ~ that’s where the problem started.

    How to run searches and list posts on pages when they were no longer defined the way the theme expected them to be?

    And now I have gone full circle.

    If I were Brian Gardner, I would be forking the code and differentiating Genesis even further with integrated “cornerstone” posting as a switchable option for corporates users.

    Hey, but that’s me, and what do I know.



    Bill Murray

    I’ve read the Cornerstone stuff. If I were to put it in a category, I’d have to use “gobbledygook”.

    From your link:

    Using categories as a pseudo site structure in WordPress is an easy way to group and display posts as if they were in different sections. It works, but let’s face it, it’s a hack …

    This is a logical fallacy of using a conclusion (that categories are bad) to attempt to prove the conclusion. Logic proceeds from thesis to evidence to a conclusion. It’s a sign of a weak argument to start with the conclusion.

    Posts should belong to a single section in the site’s structure.

    Fair enough. Put them in a single category. Case closed.

    As mentioned above though, posts can have multiple categories, and you have no control over which category is used in a post’s permalink.

    False. Put posts in a single category and you have complete control over the permalink. The author skips over the point where a post might fit under multiple pages, because that creates the same problem he complains so much about with categories. Want your category archives to be dressed up? Just take the time to create category templates.

    …pages can include additional content that categories cannot such as rich text content, custom metadata, media attachments (photos, videos, images, etc.)

    True. And it’s a fair complaint that the category description above an archive doesn’t give you a lot of that, or at least not easily. Hence, my recommendation that you create a page, which can have all the things listed above, and have that page template pull posts from a category. That is easily accomplished by creating a page template.

    Let’s grant that a cornerstone approach to content creation is the right approach. There’s nothing that’s incompatible with the standard WP tools of posts, pages, categories, and tags. Note that the CopyBlogger article to which you linked doesn’t say WP can’t do the job. I think you’ve mixed 2 notions: first, that cornerstone content is good (something I agree with), and second, that WP off-the-shelf can’t create or manage such content (something I disagree with and something I don’t think the plugin author demonstrates).

    Since you’re not a dummy and have opened numerous threads across several forums trying to get this (using the plugin) sorted out, it’s not straightforward. It seems to me to be more complicated than its worth, especially since the basic WP functionality does the job just fine.

    Web: or Twitter: @wpperform

    We do managed WordPress hosting.



    Actually Bill, I don’t disagree with your arguments.

    I just disagree with your reasoning and conclusion. Let me tell you why.

    All discussion of anything esoteric and highly technical, apart from the potential lack of understanding of either party, is always open to perception, opinion, prejudice, agenda and context.

    And with those six friends, who needs enemies, right?

    So, let me deal with what I see as some of the differences.

    My reality ~ perception ~ is of a workplace full of computer illiterate workers trying to help other folk, or endangered animals, or the environment, and who, as part of their job, have to get the word out about their cause ~ so they blog.

    They don’t know the difference between a category or a tag, much less, which is which, why and how you use them.  However, if they have one choice ~ and only one ~ either this section or that one (as in Cornerstone),  which I can control, they will choose one.

    And from the SEO point of view, that’s better.

    My opinion is ~ its not WP that’s the problem here. Its people.

    And SEO of course.

    My prejudice is ~ I’m not going to give them all the tools they won’t understand, since they don’t have the knowledge or even the inclination to learn.  KISS.

    My agenda is ~ that even with all this lack of knowledge and several authors hammering away at keyboards in several countries, I still have to deliver the SEO result their website/enterprise needs to be successful.

    My context is ~ not that of a knowledgeable blogger running his/her own blog, but of authors and editors who can’t even spell SEO, and care even less how its done; just when its not done well.

    I bet they’re not the same as yours, right?



    Bill Murray

    You’d lose that bet :) I work with people of all levels of experience, and that’s just 1 characteristic of many, so my context usually covers a very broad range. My comments weren’t based on only being relevant or suitable for those with a lot of blogging experience.

    They don’t know the difference between a category or a tag…

    So create a custom taxonomy. If your “computer illiterate workers” are more comfortable with the term “purple elephant”, well, there you go – you have the name for your custom taxonomy. Have your metabox include the instruction to just pick 1 “purple elephant” and you’re all set. For less skilled writers, you can do a lot with the add/edit post screen to make it more likely writers produce better content. For what it’s worth, I think that’s time better spent compared to playing with the cornerstone plugin.

    You seem to think that if you perfect this cornerstone approach via the plugin, it will outperform a cornerstone approach using standard WP tools, even executed by those who aren’t SEO experts. I respectfully disagree with that.

    I think your efforts to get this plugin going would be better served to write a cheat sheet for those who will create content for your blog (only to lessen the work for editors), to control privileges (so imperfect content doesn’t go live), and to effectively train editors to better execute best practices.

    Web: or Twitter: @wpperform

    We do managed WordPress hosting.




    Oh well, you know what they say about a fool and his money… 8^)

    Yes, my first approach was to publish that cheat sheet, do some online screen-sharing training and install a workflow, so that only editors could publish. I even loaded it as a help text custom post-type available when publishing or editing a post or page.

    Excellent ~ praise all round!

    Then the first articles started to appear, no attention was being paid to what they had “learned”, and the editor then quit because she was “expected to do SEO now”.

    The rest then gave up reading what they wrote and the on-page SEO went to hell in a hand-basket in no time flat.

    Oh the joys.

    However, I had not thought about using Custom Taxonomy, and that could be a solution.  I’ll will investigate.

    Thanks for holding my hand.



    Bill Murray

    I view the employee quitting as anecdotal. Her comment likely more falls under the category of excuse than anything fundamentally wrong with your approach. Yes, creating great content requires dotting a few i’s and crossing a few t’s, but given the millions of blogs out there that do it decently, it really isn’t that hard if one gives it some attention. And that thing that isn’t hard is made even easier by your cheat sheets, etc.

    On page SEO will never be perfect in multi-author blogs. A better approach is to keep doing what you’re doing (training, hand-holding), followed by quarterly cleanups. If you take any site with multiple authors and remove the parental supervision, in a short period of time you get the same effect as a lawn invaded by stilt grass. The stilt grass overwhelms the lawn.

    On page SEO is just one part of SEO. Your real end goal is not to do great on page SEO; it’s to generate traffic appropriate for the content. You can have imperfect on page SEO and still generate a lot of traffic, so don’t sweat the imperfections.

    Web: or Twitter: @wpperform

    We do managed WordPress hosting.

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.