SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Threaded View

  1. #2
    SitePoint Member
    Join Date
    Jul 2012
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with a customization, Looking for help with code that can retrieve featured img.

    Here is the website http://ariadneswonderland.gr/ that all this conserns.

    I dislike people that beg for help without having searched for a solution and i've done the best i could before coming here
    My code doesn't work, it might not even be close to correct but it was the best i could come up with.

    On the homepage I'm using a Drop shadow box plugin
    under the gallery to show a series of images of featured posts, as of right now, as i'm still building the website all you see is the White box under the gallery and a emoticon inside it.. What i'd like is to be able to do is have some code that pulls the 5 lastest posts from a category (in this case frontpage id 7) and Displays the Featured Post Image next to each other.

    Code:
    ==============================
    =       X             X              X             X            X  =
    ==============================
    Where X is a Featured post image automatically retrieved instead of having to retrieve and add links every time i want to change a feature.
    = is the automatically generated [dropshadowbox].

    Any ideas/code/snipets/plugins that you might feel would work would be greatly appreciated.

    So far however all i've come up with is this but i can't figure out how to implement the php into the post, phpexec and similar plugins don't seem to work for this, tho simple things like echo'test'; work fine. And making it a function doesn't work as it doesn't seem to return anything :S Obviously i need alot more coding experience but as of right now i'd like to just be done with this website


    PHP Code:
    // fetching latest posts from specific category
    $categoryId 7;
    $args = array('category' =>  categoryId  'post_status' => 'publish''numberposts' => 5);
    $posts get_posts$args );
    foreach(
    $posts as $post){
      
    $feat_image_url wp_get_attachment_urlget_post_thumbnail_id($post->ID) );
     
    $post_url get_permalink($post->ID);

    Last edited by TechnoBear; Jan 7, 2013 at 05:56. Reason: Threads merged.


Tags for this Thread

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
  •