SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32
  1. #26
    SitePoint Enthusiast
    Join Date
    Feb 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    As I said earlier, the general idea is to use a secondary loop with WP_Query, then just pull the title, permalink, and featured image.
    Okay. But we have five boxes!!

  2. #27
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,615
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ingenting View Post
    Okay. But we have five boxes!!

    Use a for-loop and cycle through 5 times, so long as there are enough posts in your query to do so.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #28
    SitePoint Enthusiast
    Join Date
    Feb 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    Use a for-loop and cycle through 5 times, so long as there are enough posts in your query to do so.
    Damit, i dont get it thanks for trying. Do you have an example or some code.

  4. #29
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,615
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ingenting View Post
    Damit, i dont get it thanks for trying. Do you have an example or some code.
    It's just standard PHP code--keep in mind that you can use regular ol' PHP. Wordpress simply provides a library of functions to use.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  5. #30
    SitePoint Enthusiast
    Join Date
    Feb 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    It's just standard PHP code--keep in mind that you can use regular ol' PHP. Wordpress simply provides a library of functions to use.
    Why not custom fields ?
    http://www.advancedcustomfields.com/. Some told me this was the best answer.

  6. #31
    Barefoot on the Moon! silver trophy Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,615
    Mentioned
    56 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ingenting View Post
    Why not custom fields ?
    http://www.advancedcustomfields.com/. Some told me this was the best answer.
    That doesn't make any sense.

    You're trying to retrieve data in your theme, not add more fields in the dashboard.
    Ok, this is the general idea. I have not tested this code, so you may have to make adjustments.

    PHP Code:
    <?php

    $storedquery 
    $wp_query;
    $storedpost $post;

    $query = new WP_Query(array('posts_per_page'=>5'paged'=>1));

    if(
    $query->have_posts(){
    while(
    $query->have_posts()){
    $query->the_post();
    echo 
    get_the_title();
    echo 
    get_the_permalink();
    echo 
    get_the_post_thumbnail();
    }
    }
    else {
    //do something else if there are no posts to display?
    }

    $wp_query $storedquery;
    $post $storedpost;

    //continue using regular wordpress loop
    ?>
    Be sure to read the wordpress codex pages on each function if you are unfamiliar with them.

    For the post thumbnails function, you will have to enable support for it in your theme's functions.php file. All the relevant information should be in the wordpress codex pages.

    Again, if you haven't seen the wordpress codex, it is a MUST to read for ANY theme development, as they offer key details for every wordpress function.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  7. #32
    SitePoint Enthusiast
    Join Date
    Feb 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks will take a look, and try it out.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •