Edit "Recent Posts" in 404 page

Discussion in 'Figero WordPress Theme' started by rostin, Aug 6, 2013.

Thread Status:
Not open for further replies.
  1. rostin

    rostin Member

    Joined:
    Nov 20, 2012
    Messages:
    88
    Likes Received:
    2
    Hi
    - How can I edit edit "Recent Posts" in 404 page?
    - I want to show the recent posts that belong to for instance Category "1" and Category "2" in 404 page. Is this possible?
    - How can I make the content of 404 page RTL?

    Tnx
    recent.jpg
     
  2. rostin

    rostin Member

    Joined:
    Nov 20, 2012
    Messages:
    88
    Likes Received:
    2
    Hello,
    Just wondering why my questions were ignored. I am a paid user.
    Questions posted after my questions were answered quickly.

    Tnx
     
  3. Nitesh

    Nitesh Support Staff

    Joined:
    Oct 19, 2012
    Messages:
    5,165
    Likes Received:
    160
    Hello,

    To change heading open 404.php file and replace code given below as shown in the image.

    Code:
    <h2>Add your heading</h2>
    <ul>
    <?php
    $args = array( 'numberposts' => '5' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){
    echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> ';
    }
    ?>
    </ul>

    404.png
     
  4. rostin

    rostin Member

    Joined:
    Nov 20, 2012
    Messages:
    88
    Likes Received:
    2
    Thank you Nitesh. Can I include/exclude certain categories from recent posts?
     
  5. rostin

    rostin Member

    Joined:
    Nov 20, 2012
    Messages:
    88
    Likes Received:
    2
    I figured it out.
    I added this to include only posts from category 5:
    $args = array( 'numberposts' => '5', 'category' => '5') ;
    And I could add this to exclude posts from category 5 and 6:
    $args = array( 'numberposts' => '5', 'category' => '-5, -6') ;

    Thank you.
     
    Nitesh likes this.
Thread Status:
Not open for further replies.

Share This Page