Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-settings.php on line 186

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/backpress/functions.wp-object-cache.php on line 108

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/backpress/pomo/mo.php on line 171

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/functions.bb-l10n.php on line 484

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c03/h06/mnt/47169/domains/themehybrid.com/html/community/bb-includes/backpress/class.wp-taxonomy.php on line 581
shortcode to quickly generate list of posts based on parameters « Community

Welcome, guest!

Feel free to read the blog, browse for themes, or join the club.

The community forums are currently being phased out. At the end of February or early March 2012, you will no longer be able to post here. This is because the entire site is being restructured. Please use the main forums for discussions.

shortcode to quickly generate list of posts based on parameters

  1. This is something that I feel can be very useful and powerful for Wordpress sites, but I have no idea how to do it. It's basically a shortcode that would return a list of posts that match a query, and that list can be displayed several ways (controlled by classes, shortcode, I don't really know what's the best way).

    For example, let's say I wanted to make a page with two sections on the page. The first section would be a list of posts that have the category "Sports" and the tags"Lakers" and "Finals". The second section would be a list of posts that have the cateogry "Music" and the tag "Features". So, I would enter the appropriate shortcode for it, and on the actual displayed page would be the matching lists. Wouldn't that be really useful? I think so.
    The returned result will look like:
    Lakers in the Finals (this is entered manually, we don't want the code controlling the title, just the generated list):
    --post 1
    --post 2
    --post 3

    Music featured posts
    --post 1
    --post 2
    --post 3
    --post 4

    And we can use the styles already defined in the theme to show how the lists will be displayed. For example, maybe you want the list of posts to have the thumbnails show. Or medium-sized images shown. Or no images, just bullet symbols. Or thumbnail+excerpt. And so on.

    I've been wanting to do this for a while. This would give us (me) a really cool way to create some nice looking static pages with content that gets automatically updated.

  2. What I don't understand is the need for shortcodes. We already have WordPress functions (template tags) that handle this stuff in an easy way so users don't have to learn PHP to use them.

    To me, it seems like adding shortcodes just adds another layer of complexity.

    I do understand that those <?php symbols scare off a few users, but shortcode tags would be the same thing. They'd just look different.

  3. Can we use php code in a page?

    So you're saying that I can use php code for the query I'm looking for and just write it right into the page and that's it? That would be really awesome, I have to learn how to do that. I can make some really sweet pages with that.

  4. Yep, you can use PHP in pages if you have a PHP plugin, such as Exec PHP. Or, you can create custom page templates.

Reply

You must log in to post.

Topic Info

Topic Tags: