Forums

[Plugin: Front-end Editor] Doesn't play nice with custom field variables (4 posts)

  1. stoicboy
    Member
    Posted 3 weeks ago #

    Hey there.

    First off, great plugin, scribu! This will make my life so much easier, as a guy who quickly posts a bunch of stuff each day on my site, ShortFormBlog. One thing that often gums up the process for me is the fact that I have to make a tiny change to an article and it takes a little while to update for whatever reason. So this is the perfect plugin for me.

    However, in testing it, I noticed a problem which might make it tough for me to use.

    My site uses a lot of custom fields, largely through the More Fields plugin. It allows me to offer up multiple kinds of content and post quickly in each format.

    I grab custom fields like this:

    $embed = get_post_meta($post->ID, 'embed', $single = true);
    $cutlinefull = wptexturize(get_post_meta($post->ID, 'cutlinefull', $single = true));

    I do this so I can simply grab code for If/then/else statements like this:

    if($embed !== '' & $cutlinefull !== '' & $source !== '') {
    		echo '<div class="embed">' . $embed . '
    				</div>
    				<div class="cutlinefull">'. $cutlinefull . '
    				<a class="source" href="' . $source . '" target="_blank">source</a>
    </div>';}

    However, when I use code like this:

    $factboxhed = wptexturize(editable_post_meta(get_the_ID(), 'factboxhed', 'rich'));

    The variable doesn't take. Instead, it posts the content inline where it sees it.

    Is there something that I'm missing that can be easily fixed? I can work around this if I want, but it'll significantly increase the amount of code that my site uses, because of the way it uses custom fields.

    Thanks in advance!

    --
    Ernie Smith
    Owner/Proprietor/Intern
    ShortFormBlog
    http://shortformblog.com/

  2. scribu
    Member
    Posted 3 weeks ago #

    There's an easy fix:

    Download the development version and add a false parameter to editable_post_meta():

    $factboxhed = wptexturize(editable_post_meta(get_the_ID(), 'factboxhed', 'rich', false));

    This will cause the function to return the content, instead of echoing it.

  3. stoicboy
    Member
    Posted 3 weeks ago #

    OK, I have another issue that came up. I noticed that your code places everything in <div> tags. Is there a way to place it in <span> tags instead? The <div> blocks out columns and kinda breaks my design.

    Thanks again for the help!

  4. scribu
    Member
    Posted 3 weeks ago #

    The reason why it outputs <div>s is XHTML validation.

    It originally only outputted <span>s.

Reply

You must log in to post.

About this Topic