• I have a client who wanted his blog putting inside his company web page (www.1066gym.co.uk). To get this done quickly I used an I-frame, but now he is happy with the result I need to go back and make the page more accessible to search engines so need to do some PHP coding.

    As PHP is something I do not use day to day I am having problems getting the code to work, basically I need to read the last 15 posts and only display if the category_name = “Results”. My client is using the Theme “Triton Lite” but as this doesn’t display the columns wide enough I will need to create a new basic theme but I have no problem with this.

    I have tried the loop examples in codex.wordpress but all I get to display is the “endwhile; else;” statement “No posts matched criteria”. Obviously I am doing something wrong here but the code is not that complicated, having a stupid moment I feel.

    Any help would be appreciated.

    Ian

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi braisbyi,

    Probably you can start with this function:
    http://codex.wordpress.org/Function_Reference/wp_get_recent_posts

    Let me know if you have any further questions.

    Thread Starter braisbyi

    (@braisbyi)

    Hi Ryan,

    Many thanks for the pointer, I cut and pasted the second example with the number argument but when I run this I get the following;
    Recent Posts
    ‘5’ ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo ‘•’ . $recent[“post_title”].’
    ‘; } ?>

    It’s almost as if there is a problem with the code except I cut and pasted it.

    I also have this code just above;
    <base href=”http://www.1066gym.co.uk”&gt;
    <?php
    // Include WordPress
    define(‘WP_USE_THEMES’, false);
    require(‘./wordpress/wp-load.php’);
    require(‘/wordpress/wp-blog-header.php’);
    ?>

    Any help would be appreciated
    Ian

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Coding’ is closed to new replies.