Recipe Card
[resolved] Get Image and Title (3 posts)

  1. ibreezer
    Posted 2 years ago #

    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.


  2. Yumprint.com
    Plugin Author

    Posted 1 year ago #

    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.

  3. ibreezer
    Posted 1 year ago #

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

    	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>
            <h3><?PHP the_title();?></h3>

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


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Recipe Card
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.