• Resolved ibreezer

    (@ibreezer)


    Hi I want to create an index page much like the one you use yourselves on your site with just image and title and once you click on it you’ll get the full post with the entire recipe, so my question how would you go about to get the image and title in the simpliest way?

    Thanks in advanced.

    http://wordpress.org/plugins/recipe-card/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Yumprint.com

    (@yumprintcom)

    Hi –

    Our plugin doesn’t support what you are describing, but you could build something yourself using the information in the database. You should be able to access both the title and the image in the yumprint-recipe database.

    Thread Starter ibreezer

    (@ibreezer)

    Well i made my own custom solution if anyone else would be intrested in creating a index/archive/category page for recepies

    <?php
    	global $wpdb;
    	global $post;
    	$table_name = $wpdb->prefix . "yumprint_recipe_recipe";
    	$recipe_rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name"),ARRAY_A);
    	foreach($recipe_rows as $recipe){
    		$content = json_decode($recipe['recipe']);
    		$post = get_post( $recipe['post_id'], OBJECT );
    		setup_postdata( $post );
    		?>
            <div <?php post_class(); ?>>
    
            <div class="entry-content">
    
            <a href="<?PHP the_permalink();?>"><img src="<?PHP echo $content->image;?>" /></a>
    
            </div>
            <h3><?PHP the_title();?></h3>
            <?PHP
    
    		$content->title;
    		?>
            </div>
            <?PHP
    	wp_reset_postdata();
    	}
    
     ?>

    you can access all recipe data from the $content object here’s a list

    $content->title;
    $content->image;
    $content->author;
    $content->adapted;
    $content->adaptedLink;
    $content->summary;
    $content->prepTime;
    $content->cookTime;
    $content->totalTime;
    $content->servings;
    $content->yields;
    $content->ingredients;

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get Image and Title’ is closed to new replies.