WordPress.org

Ready to get started?Download WordPress

Forums

ReciPress
[resolved] don't use php short tags (5 posts)

  1. keith_wp
    Member
    Posted 2 years ago #

    Hi Tammy -

    needed to change all the <? to <?php before this installed ok; PHP short tags aren't always turned on in every php.ini and may eventually be phased out as they conflict with XML declarations as well.

    Otherwise, the plugin looks exactly like what I'm after - any plans on integrating (optional) photos per instruction step, or would I be better off leaving that to another plugin like NextGen gallery?

    http://wordpress.org/extend/plugins/recipress/

    http://wordpress.org/extend/themes/recipress/

  2. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    Keith,

    You are right about the short tags. That was shortsighted on my part and I will update those properly.

    I have an photo for every instruction option built in, but I commented it out to get the first release out as it's not quite polished up to everything I want for it. If you like at meta_box.php, you can find where the code is commented out. I made many changes after doing that so I can't promise what will happen if you uncomment it, but feel free to play with the functionality if you like.

    I toyed with the idea of leaving this out and making it an add-on later but wanted to test the demand for it first.

  3. keith_wp
    Member
    Posted 2 years ago #

    No worries - it is still a dev release after all.

    A couple of other things:

    • typo on line 19 of output.php - "Yeild"
    • and I can't save Measurements on the initial post save; that may be because I added a few custom measurements in the options? I'll check tomorrow.
    • You'll be pleased to know that uncommenting the image per instruction bits in meta_box.php almost works right away:
      • the table is now too wide for the edit template - adding "float:left" to the "Upload Image" button is a quick fix for my screen width at least
      • it saves the post ID of the media library image, not the src so on line 234 you'll need something like:
        if($row['image']) { $src = wp_get_attachment_image_src( $row['image'], 'thumbnail' ); echo $src[0]; }
      • and likewise on the frontend side in functions.php, something like:
        $output .= '<li style="clear:right">';
        if (isset($instruction['image']) AND is_numeric($instruction['image'])) {
        $src = wp_get_attachment_image_src( $instruction['image'], 'thumbnail' );
        $output.= '<img style="float:right;margin-bottom:10px" src="'.$src[0].'" width="'.$src[1].'" height="'.$src[2].'" alt="" />';
        }
        $output .= $instruction['description'].'
      • ';
        in the instructions loop, although preferably a bit less quick'n'dirty :) I also needed to add "clear:right" to the #recipress_recipe .recipe-taxes style...

    Another thought/feature request - using something like soundex to determine that something like "carrot" and "carrots" are the same ingredient?

  4. keith_wp
    Member
    Posted 2 years ago #

    Re. not saving the ingredient measurements when adding a new recipe: I've checked now and it is because I added custom units. As they've been stored in the db options with carriage returns as the separator and update_post_meta() doesn't do any trimming, they don't subsequently match any of themselves again.

    In meta_box.php, I've changed:
    if ($new && $new != $old) {
    update_post_meta($post_id, $field['id'], $new);

    to quickly trim measurements:
    if ($new && $new != $old) {
    if ('ingredient' == $field['id']) foreach ($new as &$ingredient) $ingredient['measurement'] = rtrim($ingredient['measurement']);
    update_post_meta($post_id, $field['id'], $new);

    but it'd probably be better handled when saving the custom units initially.

    Also, http://wordpress.org/extend/plugins/lightbox-plus/ has been working very nicely with the instruction images - I can now flip through a mini gallery of full size photos per recipe. Now I just need to take better photos :)

  5. Tammy Hart
    Member
    Plugin Author

    Posted 2 years ago #

    Keith,

    Just wanted to make sure that you're aware this feature is now available in the current releases, so don't by update shy. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags