• sysconnweb

    (@sysconnweb)


    I would like to display the 3 most recent posts on my home page. I found a plugin that does this for me however, I would like to stylize recent post 1, recent post 2, and recent post 3 differently. How would I go about doing something like that? I don’t know enough of the WP backend to go grab the most recent post from the database and put it in divA then go grab the most recent post minus 1 and put it in divB and so on with a divC.

    Any help and suggestions are greatly appreciated! ??

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter sysconnweb

    (@sysconnweb)

    Does anyone have any thoughts? Perhaps another area I should post the question in?

    how can we edit the number of recent posts we want to display? the default is 15 but i want to show the amount of posts that i have that is 35..

    does anyone knows?

    Jonas Grumby

    (@ss_minnow)

    asimplemind: Go to your theme editor and edit the Recent Posts settings (usually found in sidebar.php).

    Look for a line like this:

    <?php query_posts(‘showposts=5&orderby=date’); ?>

    Change the showposts number to what you want it to be.

    HTH,
    Skipper

    flibida

    (@flibida)

    Is there a way to make the recent posts specific for the certain category you are looking in?

    Jonas Grumby

    (@ss_minnow)

    I know that you can have an RSS feed for a particular category like this:

    https://yourdomain.ext/yourpath/?feed=rss2&category=yourcategoryname

    Of course you’d need to substitute in your own domain name, folder path, and category name.

    Try this in your “recent posts” code:

    <?php $the_query = new WP_Query(‘cat=37, 39, 40&showposts=5&orderby=post_date&order=desc’);

    Substitute in the category number(s) that you want to pull in.

    HTH,
    Skipper

    Jonas Grumby

    (@ss_minnow)

    p.s. You may want to change the order as well. The order parameter options are:

    * orderby=author
    * orderby=date
    * orderby=category
    * orderby=title
    * orderby=modified
    * orderby=menu_order
    * orderby=parent
    * orderby=ID
    * orderby=rand

    Jonas Grumby

    (@ss_minnow)

    Sorry. To clarify, those are the “orderby” parameter options.

    flibida

    (@flibida)

    Ya I actually need the code from the actual category you click on to write itself into the template. For instance if I search my categories:

    Pendants
    Earrings
    Loose Stones

    –> select pendants, I somehow need that category and template to automate the recent posts from the main template, which is the same template for each of my categories?

    Does that make any sense?
    https://www.engstones dot com

    Thanks for your time

    flibida

    (@flibida)

    Ya

    Jonas Grumby

    (@ss_minnow)

    Unfortunately I don’t know of a simple way to do that. Regardless of which category you are in at the time, the recent posts code will always be the same, so the results will be the same. I’m willing to guess that there’s a way to do it with if and elseif type of statements, but I can’t offer you a solution here as it would take some time to figure out, and time is money as they say.

    flibida

    (@flibida)

    HTH cheers

    flibida

    (@flibida)

    I’ll get back once I know what I’m asking and what the solution is ?? ShmooCon as I’m not sure ??

    Jonas Grumby

    (@ss_minnow)

    There’s probably a way to capture the category number from the current page URL and insert it into the code, but I would have to do some research to figure it out. There would also have to be a if / elseif statement so that if the user is not on a category page they get the default, which would be recent posts regardless of category assignment.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Recent Posts Display’ is closed to new replies.