ThemeShaper Forums » Thematic


How to insert shortcode into post content area?

(4 posts)
  • Started 3 years ago by trevorgreenfield
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. trevorgreenfield

    I have tried and tried, but cannot figure out where to insert shortcode, which refers to custom fields as you can see here .

    If you can please direct me to where in PHP I need to insert the shortcode so that it automatically outputs the shortcode (which then displays the custom fields) in the .edit-content area, I would be very appreciative.

    I am using a thematic subtheme.


    Posted 3 years ago #
  2. trevorgreenfield

    I mean insert it into the .entry-content area

    Posted 3 years ago #
  3. trevorgreenfield

    Well, since I got no responses here or in the WP forums, I was forces to do it the wrong 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'
    		<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>
        	        // 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();
    Posted 3 years ago #
  4. all the loops are shown in the content-extensions.php file in the thematic/extensions/lib folder. you can copy any of them into your child's functions.php and rename it to childtheme_override_some_function_name(). you can insert your code there.

    you could also filter the thematic_content conditionally, but i think the override might be easier.

    and since you mention custom post types your way isn't totally wrong. due to template hierarchy WP searches for single-customposttype.php and if it doesn't find that falls back to single.php. plus i never say stuff is wrong if it works, best practice can be debatable, but out and out wrong, meh.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.