Support » Plugin: Contextual Related Posts » Related post unwantedly included in post exerpts

Viewing 15 replies - 1 through 15 (of 35 total)
  • Plugin Author Ajay

    (@ajay)

    Do you know the page id (It’s the number similar to post id) of founders-blog?

    You can add this in the “Exclude display on” under output options.

    Bitedge

    (@whatwhatwhatwhat)

    No good I’m afraid. That stops the related posts coming up at the bottom of that page but it does not stop them displaying for every single post excerpt on the page, which what I am trying to do.

    Plugin Author Ajay

    (@ajay)

    How exactly are you generating this page? I mean, what is the code behind this?

    And what if you uncheck pages as well?

    Bitedge

    (@whatwhatwhatwhat)

    What code id behind it is not straightforward. The theme has a page builder where I just
    chose element > Blog
    If I switch from page builder to classic editor, text the corresponding code is

    [blog show_blog_aux=”yes” blog_type=”mini” item_count=”10″ category=”all” show_title=”yes” show_excerpt=”yes” show_details=”yes” excerpt_length=”40″ content_output=”excerpt” show_read_more=”no” pagination=”yes” width=”1/1″ el_position=”first last”]

    If I deselect
    Add related posts to: pages
    that does stops related posts displaying for every single post excerpt on the page.

    Plugin Author Ajay

    (@ajay)

    To be frank, I am not sure on an easier solution other than to disable the automatic insert and use the manual install.

    Can you check with the theme developer how exactly they convert the shortcode to the posts? Because I am not sure what the exclusion criteria would be in this case.

    Bitedge

    (@whatwhatwhatwhat)

    I asked the developer and they said

    “The blog shortcode can be found in \includes\page-builder\composer\lib\shortcodes\blog.php, he can take a look at the code in there.”

    Plugin Author Ajay

    (@ajay)

    Can you send this file to me?

    Please send me the file via: http://ajaydsouza.com/contact/ in a zip file

    Bitedge

    (@whatwhatwhatwhat)

    okay I just sent it in a .zip I think this is the path

    http://australian-sports-betting-guide.com.au/wp-content/themes/flexform/includes/page-builder/composer/lib/shortcodes/blog.php

    but I get an error when I load it

    Plugin Author Ajay

    (@ajay)

    You can’t access blog.php directly from your browser.

    I’ve received your email but won’t be able to look at this until late. I’ll check and respond to you with a solution if possible.

    Bitedge

    (@whatwhatwhatwhat)

    I have a clue!

    They are showing up because the text above them is a custom excerpt. I posted a post without a custom excerpt and related content did not show up. Then I added the customer exert and they show up.

    So how do I set the plug in to not add related posts to custom excerpts?

    Thanks

    Plugin Author Ajay

    (@ajay)

    Hi,

    I checked out the file you sent me. It references a function called: sf_get_post_item
    Can you get the code for that?

    Bitedge

    (@whatwhatwhatwhat)

    Sure, where would it be?

    Plugin Author Ajay

    (@ajay)

    I can’t say for sure as to which file this is in. First place you should try is the functions.php of the theme.

    Bitedge

    (@whatwhatwhatwhat)

    Well this is raucous barrel of laughs lol.

    Ctrl F in archive.PHP finds 2 instances of sf_get_post_item

    Its also in
    blog.php
    category.php
    index.php
    sf-post-formats.php

    here I hope is the relevant code from archive.php.

    <!-- OPEN page -->
    	<?php if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") { ?>
    	<div class="archive-page span8 clearfix">
    	<?php } else if ($sidebar_config == "both-sidebars") { ?>
    	<div class="archive-page row clearfix">
    	<?php } else { ?>
    	<div class="archive-page clearfix">
    	<?php } ?>
    
    		<?php if ($sidebar_config == "both-sidebars") { ?>
    
    			<div class="page-content span6 clearfix">
    
    				<?php if(have_posts()) : ?>
    
    					<div class="blog-wrap">
    
    						<!-- OPEN .blog-items -->
    						<ul class="blog-items <?php echo $list_class; ?> clearfix">
    
    						<?php while (have_posts()) : the_post(); ?>
    
    							<?php
    								$post_format = get_post_format($post->ID);
    								if ( $post_format == "" ) {
    									$post_format = 'standard';
    								}
    							?>
    							<li class="blog-item <?php echo $item_class; ?> format-<?php echo $post_format; ?>">
    								<?php echo sf_get_post_item($post->ID, $blog_type); ?>
    
    						<?php endwhile; ?>
    
    						<!-- CLOSE .blog-items -->
    
    					</div>
    
    				<?php else: ?>
    
    				<h3><?php _e("Sorry, there are no posts to display.", "swiftframework"); ?></h3>
    
    				<?php endif; ?>
    
    				<div class="pagination-wrap">
    					<?php echo pagenavi($wp_query); ?>
    				</div>
    
    			</div>
    
    			<aside class="sidebar left-sidebar span3">
    				<?php dynamic_sidebar($left_sidebar); ?>
    			</aside>
    
    		<?php } else { ?>
    
    		<div class="page-content clearfix">
    
    			<?php if(have_posts()) : ?>
    
    				<div class="blog-wrap">
    
    					<!-- OPEN .blog-items -->
    					<ul class="blog-items <?php echo $list_class; ?> clearfix">
    
    					<?php while (have_posts()) : the_post(); ?>
    
    						<?php
    							$post_format = get_post_format($post->ID);
    							if ( $post_format == "" ) {
    								$post_format = 'standard';
    							}
    						?>
    						<li class="blog-item <?php echo $item_class; ?> format-<?php echo $post_format; ?>">
    							<?php echo sf_get_post_item($post->ID, $blog_type); ?>
    
    					<?php endwhile; ?>
    
    					<!-- CLOSE .blog-items -->

    [Moderator Note: 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 by the forum’s parser.]

    Plugin Author Ajay

    (@ajay)

    Unfortunately not, it would be something like function sf_get_post_item( followed by other lines that you’ll be able to find in one of the php files

    How comfortable are you editing files?
    Because, if you only want the related posts displayed, you should be able to ideally edit single.php

Viewing 15 replies - 1 through 15 (of 35 total)
  • The topic ‘Related post unwantedly included in post exerpts’ is closed to new replies.