• Resolved lynnejo

    (@lynnejo)


    Currently trying out this plugin and it looks great – but I would like to know how to display custom fields in a template (instead of adding the shortcodes to a post)

    Is this possible?

    Many thanks
    Lynne

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author XYDAC

    (@deepakseth)

    you can use th shortcode itself in the template try using

    echo do_shortcode('[{short-code-name}]');
    such as :
    echo do_shortcode('[xy_project]');

    Or else you would have to write some more php codes..:)

    Regards,
    -Xydac

    Thread Starter lynnejo

    (@lynnejo)

    Thanks very much! Will give it a go – php codes possibly beyond me 😉

    Regards
    Lynne

    This is wrong and since it always comes up for people who are searching for how to resolve this issue, I am posting the correct way to do this.

    echo do_shortcode('[xydac_field]{short-code-name}[/xydac_field]');

    a real example would be

    echo do_shortcode('[xydac_field]xy_project[/xydac_field]');

    I hope this helps. This information should really be in the FAQ section for the plugin because it is not obvious.

    I implemented this as follows.

    I have a custom post type called ‘event’. I copied single.php to single-event.php and then did the above to display the custom fields associated with my event in the markup I wanted.

    THANK YOU swill

    I spent the better half of the day trying to find out how to do this. I am new to the wordpress Loop and structure and fairly new to php.

    But where do I insert this echo line so that it prints in the .entry-content area?

    Trevor

    Since swill did not respond, and I got no response on the Thematic forums, I was forced to do this the wrong and ugly way.

    I have no idea where to properly inject my shortcodes in the functions of the loop, I have altered the single.php in my child theme to single-customposttypename.php and essentially removed the thematic_singlepost function, then rebuilt it using HTML and PHP. Its ugly, and its wrong, but it works.

    // calling the widget area 'single-top'
        	        get_sidebar('single-top');
    
    		?>
    
    		<div id="title" class="entry-title"><?php wp_title(); ?></div>
    		<div id="rr-tngreview"><?php echo do_shortcode('[xydac_field]tngreview[/xydac_field]'); ?></div>
    		<div id="link"><a href="<?php echo do_shortcode('[xydac_field]link[/xydac_field]'); ?>">Visit the Website</a></div>
    		<div id="image-from-website"><img src="<?php echo do_shortcode('[xydac_field]image-from-website[/xydac_field]'); ?>"></div>
    		<div id="copied-text-from-website">From the Website:<?php echo do_shortcode('[xydac_field]copied-text-from-website[/xydac_field]'); ?></div>
    		<div id="testimonials"><?php echo do_shortcode('[xydac_field]testimonials[/xydac_field]'); ?></div>
    		<div id="link"><a href="<?php echo do_shortcode('[xydac_field]link[/xydac_field]'); ?>">Visit the Website</a></div>
    
    		<?php
    
        	        // action hook creating the single post.  Commented and added the manual title php and echo shortcodes to get the shortcodes to work right. Uncomment the line below to return to original.
        	        // thematic_singlepost();

    Note above due to this forum not allowing links you have to imagine the a href markup.

    Heaven know how the code below looks like when posted but this is what I have now managed to do to get post fields to show.

    I found a plugin called Get Custom Field Values which when used in conjunction with Ultimate Post Type Manager does the job.

    This provides an alphabetical listing of a custom post type with pagination (and a featured image).

    Of course it can be played about with but this does show it in context and someone might find it useful.

    (I would be very grateful for some help in making email and website fields into links though – that still escapes me!)

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Sorry – code too long – new at this…

    Here is the pastebin link:

    http://wordpress.pastebin.com/48b7RHqu

    Mljo, could you help me out???

    I would like to display HTML out of the Custom Fields but I don´t know how!!!

    I will if I can – could you explain a little more by describing exactly what you want to do?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Ultimate Post Type Manager] Display custom fields in template?’ is closed to new replies.