• Resolved gitika18

    (@gitika18)


    Hi,
    I am trying new WP Ultimate recipe plugin for posting recipes. The new recipe posts does not show up under ‘post’ in my dashboard but shows up as ‘recipe’ and on the website the recipe post is not displaying the featured image with excerpt. The plugin author says that it may be due to some compatibility issue with the theme and was able to work around by making changes in the theme’s (free downloadable file that I sent to him) functions.php file with following code-

    add_action( ‘generate_after_entry_header’, ‘generate_recipe_image’ );
    function generate_recipe_image()
    {

    if ( !has_post_thumbnail() )
    return;

    if ( ‘recipe’ == get_post_type() && !is_single() ) {
    ?>
    <div class=”post-image”>
    ” title=”<?php the_title(); ?>”><?php the_post_thumbnail(); ?>
    </div>
    <?php
    }
    }

    If I understand it correct, making changes to the core files will be lost during updates if it is not a child them. I do not use a child theme and wonder if there is a simpler way to do it. Meaning- to get the featured image show up with recipe post excerpt. It’ll really help.
    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    You can use a child theme, and include the code above inside the functions.php file.

    You can find a blank child theme to install here: https://generatepress.com/api/themes/generatepress_child.zip

    Let me know if that works or not ??

    Thread Starter gitika18

    (@gitika18)

    Thanks Tom!

    So if I install the child theme now,what will happen to the content, plugins and the settings that I currently have? Will they automatically get transferred or I’ll have to do anything specific? Also, Do I have to reinstall the GP premium plugins or what?

    I don’t know much about the technical stuff.

    Thanks and wish you a very happy new year 2015! ??

    Theme Author Tom

    (@edge22)

    Everything will stay the same – the one thing you may need to do is re-set your “Theme Location” in “Appearance > Menus”.

    I also suggest keeping a tab open with your “Appearance > Widgets” page as a reference, just in case widgets get messed up – but they absolutely shouldn’t.

    Content, settings and plugins won’t be touched at all ??

    Happy New Year!

    Thread Starter gitika18

    (@gitika18)

    Hi, I wasn’t active on my site for a while. But today I installed the child theme and added the code I wanted for the image and it works. The widgets, menu, footer and the header did get messed up and did not change to the earlier settings even after importing the files that I exported and saved before install.

    Did I miss something? was I suppose to do anything else other than just download the child theme in the link above, install and activate?

    I just saw another thread in your forum which talked about importing and some coding stuff in relation to child theme- https://www.ads-software.com/support/topic/child-theme-121?replies=11

    I did not do anything, just activated the zipfile you gave. I had to fix the widget, menu, header and footer though. But it looks OK now.

    I don’t see any codes in the function.php and style.css files except /*some statements*/. Again, what did I miss? Did I need to import codes from the parent theme I was using before?

    Thanks.

    Theme Author Tom

    (@edge22)

    If all you did was install a child theme, then you shouldn’t have had to do anything at all other than install and activate it.

    The menu usually has to be re-set when themes are changed, but the widgets, header and footer shouldn’t have changed at all – what exactly happened to them?

    Thread Starter gitika18

    (@gitika18)

    Yes, I just downloaded the zipfile from the link you gave, installed and activated.

    Earlier I had SM icons in the header, which moved to the footer.
    Any widgets that I had in footer, disappeared from there.
    Widgets from the right sidebar either changed location or disappeared from there.

    Although they all went back to the available widgets but preserved the content/links. So I just had to drag and drop them back to their previous locations.

    Theme Author Tom

    (@edge22)

    Weird, usually that doesn’t happen between child themes and parent themes, but I know it can between two different themes completely.

    Sorry about that – hopefully it’s all back to normal now ??

    Thread Starter gitika18

    (@gitika18)

    Yes, I thought so too. But the problem wasn’t that big. I just had to drag and drop them back to their previous locations. It is back to normal now.

    One more thing, I don’t see any theme’s inc/template-tags.php file and any codes in the function.php and style.css files except /*some statements*/. I was recommended to add some codes following codes to make my recipe posts act ac regular posts, but now I don’t know where should I add those-
    Where do I add them now ??

    For the categories and author try editing your theme’s inc/template-tags.php file.
    On line 227 you have
    if ( ‘post’ !== get_post_type() )
    Change this to
    if ( ‘post’ !== get_post_type() && ‘recipe’ !== get_post_type() )

    In your theme’s content.php file on line 17 you have
    `<?php if ( ‘post’ == get_post_type() ) : ?>
    Change this to
    <?php if ( ‘post’ == get_post_type() || ‘recipe’ == get_post_type() ) : ?>

    And basically the same thing on line 47:
    <?php if ( ‘post’ == get_post_type() ) : // Hide category and tag text for pages on Search ?>

    Thanks

    Theme Author Tom

    (@edge22)

    You won’t want to change those in the parent theme as you’ll lose the changes when you update the theme.

    You’ll need to copy these files from the “generatepress” folder, and then add them into your child theme in their respective directories.

    content.php should be in the root of your child theme, and template-tags.php should be in a folder named “inc”.

    Doing this will also mean that you won’t get any of the changes I make to either of these files – your theme will use your files and ignore my new ones.

    Thread Starter gitika18

    (@gitika18)

    Thanks! Sounds like I’ll have to give up a lot for this one plugin ??
    One more thing, if I understand right, I don’t have to copy any file from the generate press folder to the child theme if I’m not making any changes to them. And even if those directories look blank in the child theme, I’ll be getting all your updates? right?

    Theme Author Tom

    (@edge22)

    That’s correct ??

    Hi there, you should try easy recipe plugin.
    https://www.ads-software.com/plugins/easyrecipe/

    I use it on my site using GeneratePress, the only catch is you have to deactivate the plug in while your editing in the customizer.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Featured image doesn't show up with the excerpt with the new recipe plug in’ is closed to new replies.