Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Eric Amundson

    (@sewmyheadon)

    Howdy Tracypar,

    Not sure what’s going on there, but I’ve a few questions for you:

    1. Is your post a custom post type or taxonomy, or is it a standard WordPress Post?
    2. Have you tried other options in the shortcode to make sure it’s working to pull in a specific number of posts, a different category, a tag? For instance, you could try a different category and see if it works and try removing the category=’tips-tips’ and limiting posts to: showposts=’3′ (or something similar)?
    3. Do you have a page you can point me to to see it in action?
    Thread Starter Tracypar

    (@tracypar)

    Eric:

    I played with this for some time, taking your advice. Nothing worked however I finally realized what was going on. Where the code reads “category=’category-slug'” I took it to mean that I would put first the category name then dash then slug name. I now understand that in fact it was only the slug that was intended in that space.

    I thank you for your immediate attention and assistance. And I apologise for being a bit slow on the uptake!

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Glad you got this sorted, TracyPar. πŸ™‚

    Hi!
    I’m having the same problem. Please check out the page: http://www.trestlegroup.com/publications/

    I’m using the following short code: [ic_add_posts category=’publications’ showposts=’2′]
    yet it’s pulling in all posts of various categories and not limiting the number of posts shown.
    Any ideas?

    Thanks for your feedback – greatly appreciate the help.

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi jan.uetz,

    A few questions to get started:

    1. What version of the plugin are you using? Make sure it’s the latest.
    2. I’m guessing your site’s set to use the default 10 posts per page under Settings/Reading? If you change that number, does it affect the number of posts displayed on your publications page? I’m guessing so.
    3. Have you tried another category to see if it works correctly?
    4. What happens if you remove the category='publications' from your shortcode?

    Hi Eric,

    Thank you for your reply. I realized the problem is a different one. If the page is using the default page template, then the shortcode works, however, I had the page set to the blog template. I like the layout of blog page better, so now I just need to revamp that.

    thanks!

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Glad you got it sorted. πŸ™‚

    Since the default output of the Posts in Page plugin is unstyled with minimal markup, you’ll notice that it doesn’t always inherit each theme’s styles.

    If you run into that, you can look at Changing the Output Template and tweaking your customize PiP output template to have the same structure and classes used by your theme.

    Anyway, good on ya’ for figuring it out. Cheers!

    Hi Eric,

    I’ve tried to further sort this out with the suggestion you made regarding changing the output template. While I am now getting the styling I want (from the theme), the plugin is now again outputting all posts and not only the ones from the category I’ve designated.

    Here’s my code: [ic_add_posts template=’template-blog.php’ category=’publications’]
    Any idea why it won’t show only the ‘publications’ but all post categories?

    I appreciate your help!

    Plugin Author ivycat

    (@ivycat)

    Hey Jan,

    Questions:

    1. Where does the template-blog.php file exist in your theme?
    2. Can you paste, or link to the code in your template-blog.php file?
    3. If you remove the template='template-blog.php' does it pull in the correct posts?

    Hi!
    thanks for your reply.

    Here are my answers:
    1. it’s in the root folder of the theme (and it is obviously found by the plugin, as the design changes, but then also shows all categories instead of only “publications”0
    2. Here’s the code:

    <?php
    if ( ! defined( 'ABSPATH' ) ) exit;
    /**
     * Template Name: Blog
     *
     * The blog page template displays the "blog-style" template on a sub-page.
     *
     * @package WooFramework
     * @subpackage Template
     */
    
     global $woo_options;
     get_header();
    
    /**
     * The Variables
     *
     * Setup default variables, overriding them if the "Theme Options" have been saved.
     */
    
    	$settings = array(
    					'thumb_w' => 100,
    					'thumb_h' => 100,
    					'thumb_align' => 'alignleft'
    					);
    
    	$settings = woo_get_dynamic_values( $settings );
    ?>
        <!-- #content Starts -->
        <div id="content" class="col-full">
    
            <?php woo_main_before(); ?>
    
            <section id="main" class="col-left">       
    
    		<?php woo_loop_before(); ?>
    
            <?php
            	if ( get_query_var( 'paged') ) { $paged = get_query_var( 'paged' ); } elseif ( get_query_var( 'page') ) { $paged = get_query_var( 'page' ); } else { $paged = 1; }
    
            	$query_args = array(
            						'post_type' => 'post',
            						'paged' => $paged
            					);
    
            	$query_args = apply_filters( 'woo_blog_template_query_args', $query_args ); // Do not remove. Used to exclude categories from displaying here.
    
            	remove_filter( 'pre_get_posts', 'woo_exclude_categories_homepage' );
    
            	query_posts( $query_args );
    
            	if ( have_posts() ) {
            		$count = 0;
            		while ( have_posts() ) { the_post(); $count++;
    
    					/* Include the Post-Format-specific template for the content.
    					 * If you want to overload this in a child theme then include a file
    					 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
    					 */
    					get_template_part( 'content', get_post_format() );
    
            		} // End WHILE Loop
    
            	} else {
            ?>
                <article <?php post_class(); ?>>
                    <p><?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?></p>
                </article><!-- /.post -->
            <?php } // End IF Statement ?> 
    
            <?php woo_loop_after(); ?> 
    
            <?php woo_pagenav(); ?>
    		<?php wp_reset_query(); ?>                
    
            </section><!-- /#main -->
    
            <?php woo_main_after(); ?>
    
    		<?php get_sidebar(); ?>
    
        </div><!-- /#content -->    
    
    <?php get_footer(); ?>

    [Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

    3. Yes, if I delete the template=’template-blog.php’ then it pulls in the correct category only!

    Thanks for your help and any ideas you might have.

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Aha! Okay, I think the problems are:

    1. the template you’re trying to use to render your posts is part of your Woo theme
    2. the Woo template also has a custom query.

    It’s a bit confusing because we’re referring to a template you use to render the Posts in Page posts, but this isn’t really a traditional theme template, just a file we included in the theme that you can edit, duplicate, modify, to affect what happens inside the Loop.

    If you look closely at the posts_loop_template.php file, you’ll see that it’s simply the markup that appears inside the loop, not the other stuff that you’d normally see in a standard WordPress theme template.

    <!-- NOTE: if you make changes to this file, move it to your current theme's
    	directory so this file won't be overwritten when the plugin is upgraded. -->
    
    <!-- Start of Post Wrap -->
    <div class="post hentry ivycat-post">
    	<!-- This is the output of the post title -->
    	<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    	<!-- This is the output of the excerpt -->
    	<div class="entry-summary">
    		<?php the_excerpt(); ?>
    	</div>
    
    	<!-- This is the output of the meta information -->
    	<div class="entry-utility">
    		<?php if ( count( get_the_category() ) ) : ?>
    			<span class="cat-links">
    				<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    			</span>
    			<span class="meta-sep">|</span>
    		<?php endif; ?>
    		<?php
    			$tags_list = get_the_tag_list( '', ', ' );
    			if ( $tags_list ):
    		?>
    			<span class="tag-links">
    				<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    			</span>
    			<span class="meta-sep">|</span>
    		<?php endif; ?>
    		<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    		<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
    	</div>
    </div>
    <!-- // End of Post Wrap -->

    Here’s what I’d do:

    1. copy the posts_loop_template.php file into your theme’s root
    2. edit the markup so it contains the classes you’re using in your Woo theme – this should help your default styles ‘propagate’ to your PiP posts.

    Note: the posts_loop_template.php file is a fraction of the code you pasted from the WooTheme. The entire PiP template basically corresponds with this line in your WooTheme:

    get_template_part( 'content', get_post_format() );

    I hope that helps.
    Eric

    Thank you! That took care of it – perfect! πŸ™‚

    Plugin Author Eric Amundson

    (@sewmyheadon)

    My pleasure. Have a great week!

    I’m also having trouble with the category code.

    See the Agriculture tab on the website here: http://tularevoice.com

    It pulls in the post just fine, but when I apply the same code to other pages I don’t get the same result. I’ve tried other variations, like the tag code but don’t get results.

    What am I doing wrong?

    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi justinstoner,

    1. What exact shortcode are you using on the pages?
    2. Are you using one shortcode on multiple pages, or is the shortcode on each page different?
Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Category code pulling all blog posts’ is closed to new replies.