Support » Plugin: Front-end Editor » [Plugin: Front-end Editor] Editable Content With Custom Post Types

  • Resolved C. Spencer Beggs


    I have been working on a project with your inline editing plugin, which is very slick. In a previous release, you said that you supported custom post types. I have registered a new post type called “Deals” but I am not getting the proper markup for the editor when I output text with the_title(), etc. It just outputs regular text without the special <input> markup you JavaScript uses. Interestingly, editable_meta_data() works with custom post types.

    Do I have to tell my post type to support front-end editor?

    Thanks for your help.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author scribu


    If you’re able to edit them in the backend, you should be able to edit them on the front-end as well.

    Please paste your CPT definition code.

    Here’s the code. I am trying to make a table that can be edited:

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

    On the live page the cell with content outputted by the_title() and the_terms() cannot be edited, however, the content output with editable_post_meta() can be.

    Thanks for your help.

    Plugin Author scribu


    Ok, but I meant the register_post_type( ... ) code.

    If you don’t have something like that, add the following code after the code you just posted and paste the results:

    <?php print_r( get_post_type_object( 'deal' ) ); ?>

    Ah, sorry for the confusion. Here is the code from functions.php:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    Sorry about that. Here is the code to initialize the custom post type:

    Here is the output of your request:

    Plugin Author scribu


    I’ve added that code to my local install and it works fine.

    Try disabling all other plugins. Then, try swithching to the default theme.

    Hi, scribu,

    I have tinkered around with this. I tried deactivating all other plugins and then registering the same post type in the custom theme, but I am still unable to edit the title, or any of the custom taxonomy fields when I display the custom post_types. I tried this in the default theme.

    Am I calling back the fields imporperly?

    <?php the_title(); ?>
    <?php the_terms($post->ID, 'industry'); ?>
    <?php the_terms($post->ID, 'source'); ?>
    <?php the_terms($post->ID, 'location'); ?>

    the_title(); call is editable when I am looking at it inside the regular loop. The only think I can think is that something is going awry when I register the custom post type. I am using the ‘capability_type’ => ‘post’ argument. Should I be listing something else in the ‘capabilities’ array?

    Thank you again for your help. Oh, and thank you for catching that bug about evaluating custom fields with 0 values. That was killing me 😉

    Plugin Author scribu


    All those fields will only be editable if you’re in The Loop.

    Specifically, in_the_loop() has to return true.

    Bingo, that seems to be the issue. I am calling a custom WP_Query:

    $args = array(
        'post_type' => 'deal',
        'post_status' => 'publish',
        'orderby' => 'date'
        $deals = new WP_Query($args);
        if ($deals->have_posts()) :
        while ($deals->have_posts()) :

    The fields aren’t edible when I do just that. It looks like WordPress does not consider me to be in the loop, i.e, (in_the_loop() returns false. Luckily, I can manually adjust this with:

    <?php $wp_query->in_the_loop = true; ?>

    Thanks for helping me troubleshoot.

    Plugin Author scribu


    Glad to hear you figured it out.

    I have to make that check in order to prevent titles in menus from being editable etc.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: Front-end Editor] Editable Content With Custom Post Types’ is closed to new replies.