I just can't figure out how to...

I have gotten really close with my objective (to create a super simple way for people to sell their dolls on a wp site using their own paypal buttons).

You can see the results here: http://ndandtbc.com/new/dolls-by-mindy/ads/my-2nd-ad/ (single post)

I am struggling with how to get the custom fields to display IN the post content... any ideas out there?

I have some other challenges with displaying things like the ads categories in a menu...

I've tried to find answers (for many hours) but I don't seem to be "getting it". Thanks in advance for any direction.

Harmony

  • Mike

    Hi @bettereverything

    Thanks for posting your question!

    Do you mean that you want to display the custom fields IN the post content?

    If so this will only be possible with a plugin I think.

    I've done a quick google search and found this:
    http://wordpress.org/plugins/custom-fields-shortcodes/

    Using that plugin you can apparently insert your custom fields as a shortcode. I've not used the plugin myself, but give it a go and see if it works for you. There are probably others out that that will do similar things.

    Please reply and let me know how you get on and if I've got the wrong end of the stick, please correct me by re-wording your question :slight_smile:

    Cheers,
    Mike

  • coburnenterprises

    Hi Mike, maybe a rephrase is in order ... I want the custom fields to appear after the content but above the post footer... I am guessing I need to write some sort of function (I've tried) but I am not getting it right.

    I think I need to add a line in the content-single.php (under 'content' => theme_get_content(), but before 'after' => theme_get_metadata_icons('category', 'footer'),.... but I can't figure out what to add - here is the code that currently makes up the "content" for a single post:
    <?php
    /**
    *
    * content*.php
    *
    * The post format template. You can change the structure of your posts or add/remove post elements here.
    *
    * 'id' - post id
    * 'class' - post class
    * 'thumbnail' - post icon
    * 'title' - post title
    * 'before' - post header metadata
    * 'content' - post content
    * 'after' - post footer metadata
    *
    * To create a new custom post format template you must create a file "content-YourTemplateName.php"
    * Then copy the contents of the existing content.php into your file and edit it the way you want.
    *
    * Change an existing get_template_part() function as follows:
    * get_template_part('content', 'YourTemplateName');
    *
    */
    global $post;
    theme_post_wrapper(
    array(
    'id' => theme_get_post_id(),
    'class' => theme_get_post_class(),
    'title' => theme_get_meta_option($post->ID, 'theme_show_post_title') ? get_the_title() : '',
    'heading' => theme_get_option('theme_single_article_title_tag'),
    'before' => theme_get_metadata_icons('edit', 'header'),
    'content' => theme_get_content(),
    'after' => theme_get_metadata_icons('category', 'footer'),
    'comments' => theme_get_comments()
    )
    );
    ?>

  • coburnenterprises

    Hi there - is this a public question? I am just wondering if there is someone in the community that might be able to help me - I appreciate your attempts Mike but I need someone to help me understand how to fit the solution into my particular theme. I probably need to write a function - but I don't know how. If I could figure out how to write the function then I could insert something like this into the loop:
    'ads' => theme_get_ads(), Which would pull up the php template where I insert the php code that we know works (but right now it shows below the post footer).

  • Mike

    Hi @bettereverything

    I found your blog on your site and had a look, are you trying to add an advert between the content("You could write whatever you want here.":wink: and the categories?

    I see that your theme is custom made for your site so it depends how the functions are being run, however you could try this:

    theme_get_meta_option($post->ID, 'ads'),

    You'd have to customise it though and it would probaably be better to just add a <?php get_post_meta(); ?> to the template file that renders the actual post part of the page.

    It might also be possible to do something like this:

    'content' => theme_get_content() . get_post_meta(),

    however all of the above comes under 'custom coding' which we don't do on these forums, so it might be worth checking our WPMU JOBS

    I hope this helps.

    Cheers,
    Mike

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.