Viewing 15 replies - 1 through 15 (of 20 total)
  • Nice site. ??

    Since your WordPress is installed to a subdirectory, your homepage is “outside the loop” so to speak, so what you could do is use your RSS feed to publish the last (however many) items posted.

    There’s a free script called RSStoHTML that can output your list for you. All you’d have to do is just use an include statement to call the script wherever you’d like the entries output.

    Since you want 12 entries instead of the default 10, be sure to go Options, Reading Options, and adjust the Syndication Feeds values.

    Hope that helps! ??

    Thread Starter nickfzx

    (@nickfzx)

    cool thanks…i thought it might be something to do with rss but i have no idea how to use it.

    Is it possible to only output the last 12 from one particular category…eg the news category?

    I believe so. I’ve never tried it, but according to this post all you’d have to do is just add “feed” to the end of the category URL.

    Hope that helps! ??

    Thread Starter nickfzx

    (@nickfzx)

    cheers for your help…i’ll spend a while now figuring it out ??

    This is what I used:

    <?php
    $posts = get_posts("category=2" . "&numberposts=5");
    if( $posts ) :
    ?>

    <div class="recent-posts">

    <h4><a href="index.php?cat=2">Recent News &raquo;</a></h4>

    <ul>

    <?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
    <?php
    $even_odd = ( 'odd' != $even_odd ) ? 'odd' : '';
    ?>
    <li class="<?php echo $even_odd; ?>"><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    </ul>

    </div>

    <?php endif; ?>

    The parts you’ll need to change: (Line numbers include blank lines)
    Line 2, change the category id# and the number of posts to show.
    Line 8, the “href” of the category id# archive. And of course the category name on that same line.

    Thread Starter nickfzx

    (@nickfzx)

    Hi Ryan

    this looks useful but i can’t seem to work out what to do with it…where do I put this code? is it unrelated to rss2html?

    thanks

    Nick

    Thread Starter nickfzx

    (@nickfzx)

    hi i have tried this using rss2html

    <?php
    include ‘https://www.amateurillustrator.com/rss2html.php?XMLFILE=amateurillustrator.com/articles/wp-rss.php&TEMPLATE=https://www.amateurillustrator.com/sample-template.html&MAXITEMS=12&#8217;;
    ?>

    you can see what happens here:
    https://www.amateurillustrator.com/try.php

    it just says: Unable to open RSS Feed wp-rss.php, exiting

    any ideas

    Thanks

    Nick ??

    Thread Starter nickfzx

    (@nickfzx)

    ooop ive got something now

    Thread Starter nickfzx

    (@nickfzx)

    any idea why the dates are all the same?

    also why there are only 10 entries although i specified 12?

    https://www.amateurillustrator.com/try.php

    Thanks

    Re: 10 entries – “Since you want 12 entries instead of the default 10, be sure to go Options, Reading Options, and adjust the Syndication Feeds values.”

    Re: Date – I’m seeing them all as the same date on your site. I’m assuming they were all posted 8/7/06?

    If anything, you could edit the date/time stamp in the post itself to give them a bit of diversity on your calendar.

    Any page that is outside the WP installation can still have WP stuff on it. Just add this to the top of the page:

    <?php
    require('pathtoyourwordpressinstall/wp-config.php');
    ?>

    Now you can use any WP functions on that page. If you want a page with RSS feeds in it using WP’s RSS function (as seen on your Dashboard), that’s possible.

    For what you want, you wouldn’t even need to do that. Just use ryanfitzer’s code from that earlier comment, add that REQUIRE statement I listed above, and you should have a page, outside your WP directory, that will display the content from that specific category.`

    Thread Starter nickfzx

    (@nickfzx)

    thanks everyone i think i have got it now

    https://www.amateurillustrator.com/try3.php

    all i need to do now is beat this into shape with css and add it to my homepage.

    Cheers

    Nick

    I have used this plugin for a similar thing on my site:

    https://www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/

    and then you just insert

    <?php c2c_get_recent_posts(12, "

    • %post_URL%
    • ", '6'); ?>

      Where you want the listing. The ’12’ is the number of posts to display, the ‘6’ is the category ID.

      Hope it helps

    tsguitar, good to know! Thanks for sharing that. ??

    Thread Starter nickfzx

    (@nickfzx)

    hey everyone

    thanks for all your help

    i have done now what i set out to do

    https://www.amateurillustrator.com/index.php

    the news box shows the last 12 news posts with the date next to it.

    Thanks everyone:

    here is the code i used by the way: (this was stuck into the homepage)

    <?php
    require(‘./articles/wp-config.php’);
    ?>

    <?php
    $posts = get_posts(“category=4” . “&numberposts=12”);
    if( $posts ) :
    ?>

    <div class=”recent-posts”>

    </div>

    <?php endif; ?>

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘title of new posts appear in list on homepage’ is closed to new replies.