Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #427485

    Hi,

    Instead of showing all the categories by default in the portfolio grid, is it possible to select one specific category by default ?
    When a user sees the porfolio grid, I want to display posts from category XYZ right away.

    #428011

    Hi mike235!

    Yes you can select a category to show, just edit the Portfolio Grid, the first box in the edit screen will let you select a category.

    Best regards,
    Rikard

    #428062

    Hi Rikard,

    Thank you for your reply. Sorry I didn’t explain clearly, ok let’s say in the Portfolio grid options you select the two categories “for sale” and “for rent”. On the front end, once the Portfolio grid is displayed, it shows the following links “All | For sale | For rent”. By default, “All” is selected, showing both posts from the “for sale” and “for rent” categories.

    What I want to achieve is to show right away the “for rent” category, but still having the choice of clicking on “All” or “For sale” links. Is that possible ?

    Best regards,
    Mike

    #428680

    Hi!

    Add this to the functions.php file:

    add_action('wp_footer', 'ava_auto_click');
    function ava_auto_click(){
    ?>
    <script>
    (function($){	
    	$(window).load(function() {
    		$('.categoryname_sort_button').trigger('click');
    	});	
    })(jQuery);
    </script>
    <?php
    }

    Change the “categoryname” to the name of the category that you want to display initially on page load. Remove browser cache before testing the page.

    Cheers!
    Ismael

    #431928

    Hi Ismael, thanks for the piece of code, it works !

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Portfolio grid default category’ is closed to new replies.