ThemeShaper Forums » Thematic

Adding a Loop

(18 posts)
  • Started 5 years ago by EvilEsq
  • Latest reply from Chris
  • This topic is resolved

Tags:

  1. I want add a page that queries database for posts in a specific category. The Page Links To plug-in is nice but I need to have static text on the top of the page as well. I'm not clear on whether it's possible to implement "the loop" in a page template. Can anyone direct me here?

    Thanks in advance!

    Posted 5 years ago #
  2. Copy the category.php to your child theme's directory and rename it to category-xx.php where xx is the category id. Edit line 13 and line 14 according to your needs (static title) .. Page links to -> the category with the ID whatever. This will display all posts in the specified category.

    Or do you need only specific posts from a category?

    Cheers,

    Chris

    Posted 5 years ago #
  3. Brilliant Chris. Mechanics worked perfectly. Caveat: still working with static text.

    Thank you!

    Posted 5 years ago #
  4. This worked well. The "Read More" function isn't working for the_excerpt however. I've tried both with auto-generated and "hand crafted" The function:

    <?php the_excerpt(''.__('Read More <span class="meta-nav">»</span>', 'thematic').'') ?>

    is in the template and works fine on the "Home" page but not on categories. Odd.

    Posted 5 years ago #
  5. Seems as if you need the latest SVN copy :-)

    Will post some tricks later today.

    Cheers,

    Chris

    Posted 5 years ago #
  6. I implemented a new filter named thematic_content into the current SVN copy. You can return the following constants:

    - full : the full post content including .. More .. is displayed
    - excerpt : the excerpt of the post is displayed
    - none : nothing will be displayed

    You could use the following code snippet in your child theme's functions.php to display the full post instead of the excerpt on a category page:

    function childtheme_content($content) {
    	if (is_category()) {
    		$content= 'full';}
    	return $content;
    }
    add_filter('thematic_content', 'childtheme_content');

    Remember that you need the current SVN copy!

    Cheers,

    Chris

    Posted 5 years ago #
  7. Marvelous Chris. Will get the SVA and give it a go. FYI- the menu is behaving oddly using the category template. There is a border / line underneath the selected menu "tab." There is no border with the other templates. I'd give you a link but my development site is pw protected due to evil hackers. If you need me describe this further or if you can give me an email address, to send you credentials, I can do that. Let me know.

    In any event, your good work is much appreciated.

    Posted 5 years ago #
  8. Works here .. do you have a link for me?

    Posted 5 years ago #
  9. Chris, My dev site is password protected. I can give you a link and credentials if you can give me your email address. My email is evil(at)evilesq.com. Thanks!

    Posted 5 years ago #
  10. Chris, After all of that... it works! Thanks!

    Posted 5 years ago #
  11. I struggled for a while for the best solution and this is what I came up with.

    function thematic_content_new() {
    
    	if (is_home() || is_front_page() || is_tag() || is_search() || is_category() || is_author() || is_archive()) { 
    
    		the_excerpt();
    	?>	<a href='<?php the_permalink(); ?>'>Continue reading <?php the_title(); ?></a><?php
    		$content= 'none';
    		return $content;
    	}
    }
    add_filter('thematic_content','thematic_content_new');

    I still need to get it working with custom classes, and I am going to try to get a similar link appearing before the blog post title.

    Posted 5 years ago #
  12. Currently thematic_content only accepts full, excerpt and none. It's no way to trick anything else into the loop.

    Will have something else for your 'til end of this weekend.

    Cheers,

    Chris

    Posted 5 years ago #
  13. Cool, though I should point out more than half of my functions.php revolves around switching off various Thematic "features" so that the theme will play nicely with Headspace and other custom SEO plugins.

    Still have a rant blog post lined up around the SEO claims of themes

    Posted 5 years ago #
  14. Andy .. would it help to have an additional filter as a master SEO switch?

    Posted 5 years ago #
  15. That was actually something I was going to suggest in my rant post - if all thtmes adding custom SEO functions could have a master switch to default to something plugins could work with, it would make things a lot easier.
    I suppose it wouldn't really be a filter, maybe just an option switch that I can also control with a set_option in functions.php so it can be used by none programmers, but I can also have it default to off when uploading a theme. or creating a new blog on wpmu

    Just like Thematic is a framework for themes, I would like to push Headspace as a framework for SEO - it needs more functionality, but I am fed up of functionality overlap.

    Posted 5 years ago #
  16. B1gJ4k3
    Member

    Did Andy's problem ever get resolved? I've been trying to figure this out for a few days now to no avail. I tried adding his read more text above, but for some reason, it ends up removing my ability to log in. Once, I log in, I get directed to just a blank page that doesn't show any errors or anything. Just a blank page... Help?

    Posted 4 years ago #
  17. B1gJ4k3
    Member

    OK, in classic "Dad, the lawnmower won't start" fashion, my inability to log in has apparently fixed itself immediately after I asked for help with it.

    I would still be interested to know if anyone has found an effective fix for the read more link, though?

    Posted 4 years ago #
  18. Could you please stop cross-posting your question everywhere in this forum!

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.