PHP Coding (3 posts)

  1. braisbyi
    Posted 2 years ago #

    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.


  2. Ryan Yu
    Posted 2 years ago #

    Hi braisbyi,

    Probably you can start with this function:

    Let me know if you have any further questions.

  3. braisbyi
    Posted 2 years ago #

    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">
    // Include WordPress
    define('WP_USE_THEMES', false);

    Any help would be appreciated

Topic Closed

This topic has been closed to new replies.

About this Topic