Forums

Arranging content by category (4 posts)

  1. popstalin
    Member
    Posted 4 months ago #

    My client wants to be able to pick where modules go on the homepage. The modules include a single post, a double inline post and a quadruple inline post.

    So, they want to be able to choose a category--say module 01--and have that appear on the page, then pick module 04 and have the 4 inline posts show up after that, then maybe 01 again and then an 02.

    Do I need to create custom post types for this to work or create a category? I'm having trouble thinking this through. Any help would be much appreciated.

    TIA!

  2. vtxyzzy
    Member
    Posted 4 months ago #

    If it is not too much to ask the client to put shortcodes on the page, you could create a shortcode that takes a parameter (or multiple shortcodes - one for each layout) that would define the layout and content.

    You might need to use a global value to keep track of how many posts have been shown so the next query will know how many to offset.

  3. popstalin
    Member
    Posted 4 months ago #

    I think a shortcode could work. Any links you could point me to, that would show me how this is done?

    Thanks!

    Also, I guess another way to look at this would be custom post type templates for the homepage, so if I'm using custom post type 01, then I dynamically load custom-post-01.php, if it's custom post type 02, then use custom-post-02.php to display the posts.

    Is that possible? I've been searching but all I've found is single.php and archive.php info for custom post type templates. These are posts, not pages.

  4. vtxyzzy
    Member
    Posted 4 months ago #

    I think this is getting beyond the scope of what can be done in this forum. However, here is a general outline of what I think will work:

    • Create a static front page that the client will edit to place the shortcodes in the desired location.
    • Create a template for the static front page.
    • Create one or more shortcodes to display the desired category (or custom post type) and number of posts.
    • Assign the new front page as the static page in Admin->Settings->Reading.

    I would not tie the post category or type to the number of posts to show because the client may (probably will) change their mind in the future. So, I would suggest something like this:

    [show-post-group type='type1' number='6']

    This would show a group of 6 posts of type1.

    Here is a tutorial on shortcodes:

    http://wp.tutsplus.com/tutorials/theme-development/wordpress-shortcodes-the-right-way/

    A Google search on 'wordpress shortcode tutorial' will find several more.

Reply

You must log in to post.

About this Topic