Display selected pages in grid

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #13725
    schercka
    Member

    Is it possible to order pages displayed with this shortcode?

    [show_post_snippets post_type=”page”… ]

    Right now it just grabs subpages to one page by using “post_parent=XXX”. But I want to control which subpages are shown, and in which order.

    Maybe if it were possible to tag pages with some kind of metadata? I tried changing wordpress standard page order with no effect. And I’m unable to specify page categories or tags to filter on.

    #13747
    Veena
    Moderator

    With taxonomy and terms specified in post snippets shortcode you will be able to filter specific category from a group of categories.

    #13759
    schercka
    Member

    It’s grabbing the right pages using ‘post_parent’, but I want to change the ORDER of the pages. It’s just spitting them out in seemingly random order. Can I get it to respect default wordpress menu ordering in ASC order? Right now it ignores this order.

    #13766
    schercka
    Member

    I tried adding:

    ‘orderby’ => ‘menu_order’,
    ‘order’ => ‘ASC’

    to the $args to function mo_show_post_snippets_shortcode in posts-shortcodes.php but with no effect.

    #13838
    Raghavendra
    Moderator

    The shortcode itself does not provide a way to order the items through its attributes. You can order it though by making a code change in the file framework/functions/post-functions.php file at line number 655. You can add the following code –

                $query_args['orderby'] = 'menu_order';
                $query_args['order'] = 'ASC';
    

    BTW, an upcoming update will have the sorting feature you are requesting and hence the above code change would not be required once the latest version is out this week.

    #13912
    schercka
    Member

    Hmm that didn’t do anything – seemingly.

    I added the code two places, since I wasn’t sure where to put it. See attached.

    In WordPress I’ve got this shortcode inserted:
    [show_post_snippets post_type=”page” number_of_columns=4 post_parent=13 post_count=”12″ class=”grid-menu” image_size=’medium’ display_title=true display_summary=true excerpt_count=80]

    And it’s pulling in the pages, but not sorting according to the wordpress page order. I’ve set one of the pages to order 999 just to test, with no result.

    Can I use the updated framework/functions/post-functions.php file, or will it not work on its own?
    I see in the 1.6 changelog that sorting is only applied to templates, nothing mentioned about post_snippets for pages.

    #13927
    Veena
    Moderator

    Kindly take backup of files before making any change.

    Pls use updated post-functions.php file and post-shortcodes.php file, and then modify line no: 286 of file post-shortcodes.php as below –

    'enable_sorting' => true
    

    And see if it helps otherwise pls let us know.

    #13941
    schercka
    Member

    That worked – I had to edit it in the original template though – it didn’t have an effect in the child theme?

    Could that be because it requires other files to also be in the child theme folder?
    I put it in themes/invent-child/framework and themes/invent-child/functions, but nothing worked until I updated the original files in themes/invent/framework and functions.

    #13947
    Raghavendra
    Moderator

    Should work with child theme as well. I will need to take a look at the actual changes made by you in the child theme. You may be missing a step actually.

    Just wondering why not just update the whole theme to 1.6 since you are using child theme anyway and then you would not need to repeat this in the child theme?

    #13978
    schercka
    Member

    I updated everything to 1.6 so this is not an issue anymore. However I’m having problems with child theme changes kicking in. Style.css has no problems, but items in my framework folder don’t seem to work, for example in my slug rewrites in custom-post-types.php. Any typical mistakes people make here?

    I am using the invent-child included in your zip.
    I’ve got the files in the same folder structure /framework/presentation/custom-post-types.php
    But changes I make in the invent-child theme don’t have an effect. Only when I make it in the original invent theme? Any ideas?

    #13979
    schercka
    Member

    Here is a screenshot of the structure.

    #13989
    Raghavendra
    Moderator

    In WordPress you are redefine the template files like single.php, archive.php in the root folder but for any subfolder, you are better off redefining the functions or overriding the classes that you want to customize. You cannot prevent the parent theme from loading the framework classes. In the above case you would include your custom-post-types.php file too in your child theme functions.php (using require_once function call) and then copy the contents of the parent theme file and automatically all the parent theme functions will get overridden due to presence of if (!function_exists(‘function_name’)) checks in the parent theme.

    Pls make sure your file is included first before the parent one. It is ok to have same file name as the parent one. Hope this clarifies.

    #13993
    schercka
    Member

    I see – thanks for explaining.

    I realize this has nothing to do with supporting your theme, so thanks for taking the time. 🙂

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Display selected pages in grid’ is closed to new replies.