Home>Support>Post Navigation: Issue: to show only post in one category: Project: “Product Site”

Post Navigation: Issue: to show only post in one category: Project: “Product Site”

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

After trying various plugins to display products ( not shopping or eCommerce, just simple product display), i have concluded that Vantage with Page Builder is good enough for the job ( most plugins are paid and bulky with features not necessary). The excellent features within the Vantage & PageBuilder allows for customisations. I shall post the TuT’s once i finish with the site, at present its on local.

I have hit steep learning curves, One of it is using Post Category to add Product has Post. I have resolved many of them.. Currently I am Facing a Issue..

1. While displaying the Post of a Category ( I have three Main Category, “Store”, “Blog” & “myTest” ), The Navigations show Post of all the three Categories , How do i Restrict it to display Navigations of only Category “Store”.

2. The Page Title is : “My Category Archives: Store”, How do I Control this Element to Display only “Store”.

3. While Displaying Category using “Post Excerpt”, is there anyway to control the Excerpts Elements, No of Words, etc.

4. While at Post Excerpts: because I am using row with two Col and First Col has Images and Second Col the Product description, the Excerpts Starts with the “Captions / Title of the Image Gallery”, I have worked around this by displaying display of Captions / Title of the Images using CSS

".my-img-captions .gallery-caption {
  display: none!important;
}

is there are better way to do this..?

Once the site is up and working to some extent, I shall host it so that others can contribute to improve it. and then a TuT……

URL: http://tsktech.local

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 10 years, 2 months ago Andrew Misplon
    Hi, I Work Here

    Hi Srikanth

    Thanks for reaching out.

    1. How are you displaying your posts? Have you tried using the Post Loop widget and building a post query to choose only posts from the category you are targetting?

    2. Using Page Builder for the page in question and adding a Post Loop widget would resolve this nicely.

    3. There is, unfortunately, no way to filter the excerpt from within theme settings. You’d need to use a child theme:

    https://siteorigin.com/wp-content/uploads/2015/03/vantage-child-starter.zip

    Within the child theme you’d need to add the following to the functions.php file:

    function vantage_child_custom_excerpt_length( $length ) {
    	return 20;
    }
    add_filter( 'excerpt_length', 'vantage_child_custom_excerpt_length', 999 );
    

    Change the value 20 to the number of words you’d like in the excerpt.

    4. Can you perhaps upload a screenshot to any public site and send the url so we can see this in action?

    Thanks

  2. 10 years, 2 months ago Srikanth Kamath

    Thanks for the quick response, unfortunately I updated the SiteOrigin widgets to 1.2.4 and it broke the WP..

    "Fatal error: Call to undefined function wp_is_mobile() in /home/tskamath/tsktech.in/wp-content/plugins/so-widgets-bundle/widgets/so-slider-widget/so-slider-widget.php on line 167”
  3. 10 years, 2 months ago Andrew Misplon
    Hi, I Work Here

    Hi Srikanth

    Sorry to hear about the hassles. Glad you hear you’ve been making progress.

    Let me know how the excerpts go.

  4. 10 years, 2 months ago Srikanth Kamath

    Dear Andrew,

    ok, I am stuck a bit.. I found a good plugin “post-content-shortcodes” which has two short codes [post-content] and [post-list]..

    with pagebuilder -> visual editor when i place

    [post-list category =9] works and display. but with [post-content post_name=end-to-end] page fails to load with error

    No data received ERR_EMPTY_RESPONSE
    details “Unable to load the webpage because the server sent no data.”

    if I do not use the pagebuilder then both the short codes work.. I have spent some hrs trying to resolve this but failed.. can you pls check the plugin and help me to get the plugin working..

    thanks in advance

  5. 10 years, 2 months ago Andrew Misplon
    Hi, I Work Here

    This is unfortunately something we see from time to time. It’ll be up to the plugin developer to enhance their plugin for Page Builder usage. There isn’t much work required, but it will need to come from the plugin developers side.

    If you can send through a link or an image to try explain what you’re doing we could try suggest an alternative route.

  6. 10 years, 1 month ago Srikanth Kamath

    off topic, but noted here so that when I come to tut stage,i can include all the steps..

    Using PHP with page Builder,

    I have to use Short Code to get Custom Field on Post had been quite a difficult task as the CFS has many options for field types. Install Plugin “ShortCode Exce PHP” and Add a New Short Code with Name: “get_Fields” and in the code area enter the code below.

    The Usage is [get_Fields arg=”Custom_Field_Slug”] will return the Value in the Custom_Field_Slug. If Error then the Error is also displayed.. details of the code at http://tskamath.pactindia.net/technology/wordpress/shortcode-get-custom-field/

  7. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Hi Srikanth

    Great blog post. Thanks for taking the time to share. I’m sure many will find that useful.

  8. 10 years, 1 month ago Srikanth Kamath

    Hi, while on this, when I was looking at the archive.php, i notice the follwoing

    <header class="page-header">
    			<h1 id="page-title"><?php echo vantage_get_archive_title() ?></h1>
    

    Fortunately no error show up, but from my newbie on PHP should this not be <?php echo vantage_get_archive_title()< ; ?> ??

    I am not sure but Pls Revert on this..

    <header class="page-header">
    			<h1 id="page-title"><?php echo vantage_get_archive_title(); ?></h1>
    
  9. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Hi :)

    Sorry, I’m not quite with you there. in archive.php line 18 does echo vantage_get_archive_title(). Could you perhaps check and let me know.

    Thanks

  10. 10 years, 1 month ago Srikanth Kamath

    the code in the file is is not missing the “; ” at the end for the echo ie ..?

  11. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Ahh right, thanks, yes it is missing the end statement semicolon. Thanks for pointing that out. We’ll correct in the next update.

  12. 10 years, 1 month ago Srikanth Kamath

    Ok I progressed and reach a level where I can move the site to Hosted Domain.. http://www.tsktech.in

    I have a few question, before that let me explain the workflow..

    The website is built using the PageBuilder. but also uses the following pages in the theme

    archive-cameratypes.php –> archive.php
    taxonomy.php –> archive.php
    content-cameratypes.php –> content.php
    edited copy of content.php in theme folder
    functions.php –> modified in Theme Folder
    single-cameratypes.php –> single.php pointing to content-camaratypes.php instead for content-single.php

    the edit to pages are minimal to insert codes.

    <!-- tsk edit -->
    /* edited into content-cameratypes.php and also content with additions if condition if ('camera-types' == get_post_type()) { ?> */
    <div class="tsk-taxonomies"> 
    	<div class="tsk-ip-ratings">
    		<?php echo get_the_term_list( $post->ID, 'ip_ratings', 'Camera IP Ratings: ', ', ', '' ); ?>
    	</div>
    	<div class="tsk-applications">
    		<?php echo get_the_term_list( $post->ID, 'applications', 'Suggested Applications for the Camera: ', ', ', '' ); ?>
    	</div>
    </div>
    

    and some H1 Page-Title changes in the other pages and the following in taxomoy.php

    
    <h1 id="page-title"> <!-- tsk edit -->
    				<!-- <?php echo vantage_get_archive_title() ?> -->
    				<?php 
    					$current_term = get_queried_object();
    					$taxonomy = get_taxonomy($current_term->taxonomy);
    					echo $taxonomy->label . ': ', $current_term->name;
    				?> <!-- tsk edit -->
    			</h1>
    

    and I am using the following plugin’s

    a) CPT UI to insert some
    Custom Post Type
    – CameraTypes
    and Taxonomy
    – ip_ratings
    – applications

    b) “Custom Field Suite” for the Custom Field and the Data from the Custom Field are pulled using shortcode using “ShortCode Exce PHP” (as illustrated earlier in the post above)

    I have the following question ( I am bit run down.. hence cheating to get help from you guys :-( sorry ) ..

    1. the content-single.php default in the theme does not pick “Posted in” data from Custom Post Types.
    — is there any fix for this..? if not how do i disable using css this display in custom post types.. ie single-cameratypes.php without breaking the pagebuilder

    2. CSS to Size the Featured images to same size in Blogs Loop widgets –> show as Grid..

    3. Not Really your issues, but more of CPT UI and also for further development. How do i prevent the “search’ from searching from Certain Post Types or Certain taxonomy.

    4. In PageBuilder I clone the existing Post for New Post every time, is there any way I can default this ie when I am creating a new post, the Pagebuilder uses a default Template.

    5. any TuT to hack the pagebuilder (opps not hack but customise). related to above para(4).

    Pls check the site http://www.tsktech.in/cameratypes

    Thanks in Advance..

  13. 10 years, 1 month ago Srikanth Kamath

    while on this, pls help on one more issues, in the Navigation, can we change the color for the “#” ie custom links, to show the visitor that some of the menu is not a true link..

    http://www.tsktech.in > “Support” and Sub Menu “Types of Camera”, “Applciations” & “IP ratings” is just a placeholder not a link. presently all the menu respond with a color change on hover to blue, i want the non links to have another color.

  14. 10 years, 1 month ago Private Message - Srikanth Kamath

    This is a private message.

  15. 10 years, 1 month ago Srikanth Kamath

    Guys also require you advise:

    Instead of having a content-cameratypes.php –> copy of content.php in the child theme, I can also use the “PHP Code Widget” to insert PHP in the Pagebuilder

    [/code]
    // using PHP Code Widget in side Pagebuilder //

    ID, ‘ip_ratings’, ‘Camera IP Ratings: ‘, ‘, ‘, ” ); ?>

    ID, ‘applications’, ‘Suggested Applications for the Camera: ‘, ‘, ‘, ” ); ?>

    [/code]

    What do you advise

    a) Modify the content.php for each Custom Post Type or
    b) Just use the Page Builder => add row => add widget “PHP code”

    I am clear that edit of of content.php is only one edit (with any modification to be done in this file) and using the PHP Widget is same code repeated in multiple pages, which clearly means that in future each page will have to be edited.

    Which bring me back to the question can we have PageBuilder Templates so that we need not clone, and any edit to the Template is applied to all the child pages using the template.

    sorry to trouble you.. but I am clear I want to promote the Pagebuilder, but also want to know exactly the limitation and also the future development “PageBuilder”..?

  16. 10 years, 1 month ago Srikanth Kamath

    Guys also require you advise:

    Instead of having a content-cameratypes.php –> copy of content.php in the child theme, I can also use the “PHP Code Widget” to insert PHP in the Pagebuilder

    // using PHP Code Widget in side Pagebuilder //
    <div class="tsk-taxonomies"> 
    	<div class="tsk-ip-ratings">
    		<?php echo get_the_term_list( $post->ID, 'ip_ratings', 'Camera IP Ratings: ', ', ', '' ); ?>
    	</div>
    	<div class="tsk-applications">
    		<?php echo get_the_term_list( $post->ID, 'applications', 'Suggested Applications for the Camera: ', ', ', '' ); ?>
    	</div>
    </div>
    

    What do you advise

    a) Modify the content.php for each Custom Post Type or
    b) Just use the Page Builder => add row => add widget “PHP code”

    I am clear that edit of of content.php is only one edit (with any modification to be done in this file) and using the PHP Widget is same code repeated in multiple pages, which clearly means that in future each page will have to be edited.

    Which bring me back to the question can we have PageBuilder Templates so that we need not clone, and any edit to the Template is applied to all the child pages using the template.

    sorry to trouble you.. but I am clear I want to promote the Pagebuilder, but also want to know exactly the limitation and also the future development “PageBuilder”..?

  17. 10 years, 1 month ago Srikanth Kamath

    2. CSS to Size the Featured images to same size in Blogs Loop widgets –> show as Grid..

    I guess you guys are busy updating the themes and widgets.. from the css (code below) i see that the Height is set to auto. Hence to have all the Grid thumbnails to same height & width the Featured Images have to be same size.

    .vantage-grid-loop article .grid-thumbnail img {
        width: 100%;
        height: auto;
    

    In my case i changed all the featured images to 90px x 68px (resized the images externally and uploaded: Note Disable the proportional scaling), Now the grid Loop Images are of same size (145 x 110px).

    Kindly revert when free, if I can manage this with CSS instead of resizing the images.

  18. 10 years, 1 month ago Srikanth Kamath

    1. the content-single.php default in the theme does not pick “Posted in” data from Custom Post Types.
    — is there any fix for this..? if not how do i disable using css this display in custom post types.. ie single-cameratypes.php without breaking the pagebuilder

    as we are using the content-single.php customised for each Custom Post type the following code can be commented

    <!-- 
    <?php if(vantage_get_post_categories()) : ?>
            <div class="entry-categories">
                      <?php echo vantage_get_post_categories() ?>
    	</div>
    <?php endif; ?>
    -->
    

    and insert the links using the following code in the above modified file example “ie single-cameratypes.php”

    <!-- tsk edit -->
    <div class="tsk-taxonomies"> 
    	<div class="tsk-ip-ratings">
    		<?php echo get_the_term_list( $post->ID, 'ip_ratings', 'Camera IP Ratting: ', ', ', '' ); ?>
    	</div>
    	<div class="tsk-applications">
    		<?php echo get_the_term_list( $post->ID, 'applications', 'Suggested Applications for the Camera: ', ', ', '' ); ?>
    	</div>
            <!-- repeat these for the as many taxonomy that you have and want to display -->
            <div class="tsk-applications">
    		<?php echo get_the_term_list( $post->ID, 'taxonomy_slug', 'Suggested Applications for the Camera: ', ', ', '' ); ?>
    	</div>
    </div>
    

    Part II .. to follow

  19. 10 years, 1 month ago Srikanth Kamath

    Part II

    Kindly revert when free, if there is a better way to go about this I have check your post “https://siteorigin.com/thread/replace-default-functions-in-vantage-from-child-theme/” but the issues is with multiple Taxomoies its not fesible ..? if its just one taxonomy then we could use the following in function.php of the child theme

    function vantage_child_filter_categories($meta) {
    	// Do what ever we want to the meta here
    	// $customPostTaxonomies = get_object_taxonomies('camera_types'); 
    	// var_dump( $customPostTaxonomies );
    	
           // test if "post" or "Custom Post" //
    	if ( 'post' == get_post_type() ) {
    		$category_list = get_the_category_list( __( ', ', 'vantage' ) );
    	} else {
                    $customPostTaxonomies = get_object_taxonomies('camera_types');
    		// $category_list = get_the_term_list( $post->ID, 'ip_ratings', __('Camera IP Ratting: ', 'vantage'), ', ', '' );
                   // change $customPostTaxonomies[x] x to the taxonomy you want to display
                  $category_list = get_the_term_list( $post->ID, $customPostTaxonomies[0] , __('Camera IP Ratting: ', 'vantage'), ', ', '' );
    	}
    

    Part III… to follow

  20. 10 years, 1 month ago Srikanth Kamath

    part III….

    // the rest of these code copied from the support link ( listed above) 
    add_filter('vantage_post_meta', 'vantage_child_filter_categories');
    

    Hope to get advise..

  21. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Hi Srikanth

    Thanks for the wait. I’ll do my best to help and appreciate you sending everything through. However going on my past experience here on the forums it’s really challenging to work several questions at once. The work space doesn’t really allow for it and things usually land up getting confusing. With this in mind I’ll try work through your first post question by question, we can go from there:

    One

    1. the content-single.php default in the theme does not pick “Posted in” data from Custom Post Types.
    — is there any fix for this..? if not how do i disable using css this display in custom post types.. ie single-cameratypes.php without breaking the pagebuilder

    Hard to say why that’s happening. We could look into it if you’d like. We’d most likely need to see a copy of your child them via email.

    To hide the post meta for your custom post type, try the following:

    .single-cameratypes .entry-meta { display: none; }
    

    Two

    CSS to Size the Featured images to same size in Blogs Loop widgets –> show as Grid..

    Please could you confirm a page for us to look at for this question.

    Three

    Not Really your issues, but more of CPT UI and also for further development. How do i prevent the “search’ from searching from Certain Post Types or Certain taxonomy.

    WordPress core handles search. You’ll need to use a custom search plugin to limit search criteria etc.

    Four

    In PageBuilder I clone the existing Post for New Post every time, is there any way I can default this ie when I am creating a new post, the Pagebuilder uses a default Template.

    To create a “template” go to a page, click Prebuilt Layouts in Page Builder, click Import/Export, click Download Layout button bottom right. Use the same process to import a layout.

    Five

    Any TuT to hack the pagebuilder (opps not hack but customise). related to above para(4).

    Hopefully my answer above is helpful. That’s the limit of the functionality we have in this regard at the moment.

    //

    Let me know and we’ll go from here. Move onto the next set of questions if you’re ready.

  22. 10 years, 1 month ago Private Message - Srikanth Kamath

    This is a private message.

  23. 10 years, 1 month ago Private Message - Srikanth Kamath

    This is a private message.

  24. 10 years, 1 month ago Srikanth Kamath

    hello is it working

  25. 10 years, 1 month ago Private Message - Srikanth Kamath

    This is a private message.

  26. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Hi Srikanth

    Sorry to hear you ran into trouble posting. There is no limit that I know of. You’re welcome to email us on [email protected]. I just replied to another thread. Can we perhaps work that first and then go from there. If at all possible I’d like to try pick out one top level question at a time, chat to Greg if needs be a get you the best answer possible. Once we have one question answered, move on etc.

    If we could start here that would be ideal:

    Thread: Can be have PageBuilder Template for other Post: create a template with page builder

    I realise you’ve put a lot of effort into explaining where you are and what you need to progress, I’m unfortunately not quite with you. The result is we’re working through a lot of information at once. If we could try work one question that would help.

  27. 10 years, 1 month ago Srikanth Kamath

    Dear Andrew,

    thanks for the revert, I understand clubbing of issues is not a good idea, Lets do it one by one.

    One

           // in custom CSS
    	.single-cameratypes .entry-meta { display: none; }  
    	however the following works
    	.single-cameratypes .entry-categories { display: none; }
    
  28. 10 years, 1 month ago Srikanth Kamath

    Still at issue One
    The modification in child theme:,
    I have made a copy of “single.php” and named it single-cameratypes.php and edited the

    	<?php get_template_part( 'content', 'single' ); ?> to 
    	<?php get_template_part( 'content', 'camera-types' ); ?>
    

    I have copied the content-single.php and named it content-cameratypes.php and just added the following code (no edits to the file)

    <!-- tsk additions -->
    	<div class="tsk-taxonomies"> 
    	<div class="tsk-ip-ratings">
    		<?php echo get_the_term_list( $post->ID, 'ip_ratings', 'Camera IP Ratings: ', ', ', '' ); ?>
    	</div>
    	<div class="tsk-applications">
    		<?php echo get_the_term_list( $post->ID, 'applications', 'Suggested Applications for the Camera: ', ', ', '' ); ?>
    	</div>
    </div> <! --- tsk addition -->
    

    Solution Option 1:
    If i comment out the following from the contents-cameratypes.php then the “Posted in:” is not shown. I am not sure if this will break anything.

    <!-- commented by tsk --
    <?php if(vantage_get_post_categories()) : ?>
            <div class="entry-categories">
                      <?php echo vantage_get_post_categories() ?>
    	</div>
    <?php endif; ?>
    -->
    

    Solution Option 2:
    after studing your post , it was clear that “get_the_category_list()” would not work with custom post types and only “get_the_term_list()” would get the taxonomy. Hence I modified the code as follows

    // in function.php of the child theme //
    function vantage_child_filter_categories($meta) {
    	// Do what ever we want to the meta here
    	// $customPostTaxonomies = get_object_taxonomies('camera_types'); 
    	// var_dump( $customPostTaxonomies );
    	
           // test if "post" or "Custom Post" //
    	if ( 'post' == get_post_type() ) {
    		$category_list = get_the_category_list( __( ', ', 'vantage' ) );
    	} else {
                    $customPostTaxonomies = get_object_taxonomies('camera_types');
    		// $category_list = get_the_term_list( $post->ID, 'ip_ratings', __('Camera IP Ratting: ', 'vantage'), ', ', '' );
                   // change $customPostTaxonomies[x] ->x to the taxonomy you want to display
                  $category_list = get_the_term_list( $post->ID, $customPostTaxonomies[0] , __('Camera IP Ratting: ', 'vantage'), ', ', '' );
    	}
           <!-- rest of the code as it is -->
         // the rest of these code copied from the support link ( listed above) 
    }
    add_filter('vantage_post_meta', 'vantage_child_filter_categories');
    

    I fully understand, you must be thinking, if by CSS or by Solution 1, if the “Tagged in:” can be hidden, why is this idiot trying more code..

    I have started on this project to get a Product Listing Web Site with multiple Taxonomies and many-to-many custom field relationships. I could have used eCommerce plugin’s but almost all of them breaks Pagebuilder, hence using the powerful pagebuilder I am going ahead. hence some of the question is for understanding the theme and vantage filters / actions., in this case the solution 2. Hope you understand and help.

    do you want me to create a admin login for you on the site..?

  29. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Sure, if you send through a set of login details I can try see what’s going wrong with the posted_on function. In your above post is that all I need to check in this set of questions?

  30. 10 years, 1 month ago Srikanth Kamath

    Dear Andrew,

    It clear to me what the issues is:

    Vantage Theme does not check if the the post type is “Custom Post Type” while executing “vantage_get_post_categories()”.

    This is Necessary because “get_post_categories()” work only on the Post Type = “post” and not custom Post Types, we require “get_the_term_list()” instead of “get_post_categories()”

    Maybe in the future updates of the vantage Theme, you could include the above conditional test in content-single.php and also provide a function “vantage_get_custompost_terms” to maintain the theme design for all the post types.

    In view of the above, We can close Issue One because it’s more of wish list than a issue now.

    added for ref. for other who visit.. if you want to include a default taxonomy for your custom post type, use the following code

    /**
     * Define default terms for custom taxonomies in WordPress 3.0.1
     *
     * @author    Michael Fields     http://wordpress.mfields.org/
     * @props     John P. Bloch      http://www.johnpbloch.com/
     * @props     Evan Mulins        http://circlecube.com/
     *
     * @since     2010-09-13
     * @alter     2013-01-31
     *
     * @license   GPLv2
     */
    function mfields_set_default_object_terms( $post_id, $post ) {
        if ( 'publish' === $post->post_status && $post->post_type === 'your_custom_post_type' ) {
            $defaults = array(
                'your_taxonomy_id' => array( 'your_term_slug' )
                //'your_taxonomy_id' => array( 'your_term_slug', 'your_term_slug' )
                );
            $taxonomies = get_object_taxonomies( $post->post_type );
            foreach ( (array) $taxonomies as $taxonomy ) {
                $terms = wp_get_post_terms( $post_id, $taxonomy );
                if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) {
                    wp_set_object_terms( $post_id, $defaults[$taxonomy], $taxonomy );
                }
            }
        }
    }
    add_action( 'save_post', 'mfields_set_default_object_terms', 100, 2 );
    
  31. 10 years, 1 month ago Andrew Misplon
    Hi, I Work Here

    Super, thanks for resolving this question and sharing your fix with everyone. Much appreciated.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More