C. Spencer Beggs
Forum Replies Created
-
Forum: Plugins
In reply to: [Front-end Editor] Checking Values of Custom Fields Before SaveSo, I have tried a lot of things to get this working. Hooking onto update_post_metadata() proved troublesome because I was, indeed, causing an infinite loop. I tried hooking on to the front-end-editor action itself, but I am getting strange results:
function update_rating() { global $wpdb, $post; $data = $_POST['data']; if ($data['key'] == 'Rating' && $_POST['callback'] == 'get') { $currentrating = get_post_meta($data['post_id'], 'Rating'); update_post_meta($data['post_id'], 'Previous Rating', $currentrating); } } add_action('wp_ajax_front-end-editor', 'update_rating', 9);
For some reason that just deletes the ‘Previous Rating’ field all together. I tried to output the info to a new key with:
add_post_meta($data['post_id'], 'Test', $currentrating);
but that just ends up being empty. Any idea why this wouldn’t work? It seems like WordPress double saves things.Forum: Plugins
In reply to: [Front-end Editor] Checking Values of Custom Fields Before SaveThanks for the reply. I will check out the hook and be sure to report back what I find here.
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()) : $deals->the_post();
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.
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 ??
Sorry about that. Here is the code to initialize the custom post type: https://pastebin.com/n5iazLwM
Here is the output of your request: https://pastebin.com/TzLv2KB1
Ah, sorry for the confusion. Here is the code from functions.php:
[Code moderated as per the Forum Rules. Please use the pastebin]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.
Forum: Fixing WordPress
In reply to: Version 2.9 image editor not workingI was struggling with this for a bit, too. To get the cropping to work, you have to drag the window (hold SHIFT to lock the aspect ratio) and then click the crop icon (the one in the upperleft corner of the toolbar) to actually get it to crop.
So, that works and appears the right way in the Media Library. Unfortunately, the post thumbnail stays the way it was when I first uploaded.
Forum: Fixing WordPress
In reply to: query_posts category_name and showposts problemI was having the exact same problem using WP 2.8.5 and Carrington JAM 1.3. I took my code out of the loop in Carrington and dropped it into the index.php in the default theme and it worked just fine. So, this sounds like a Carrington issue.
Here was the code I used (works in default theme, not in Carrington):
<ul> <?php $args=array( 'category_name' => 'features', 'posts_per_page' => 15 ); $editorials = new WP_Query($args); if($editorials->have_posts()) : while($editorials->have_posts()) : $editorials->the_post(); ?> <li> <a href="<?php the_permalink(); ?>" title="Read the article "<?php the_title(); ?>""><?php the_title(); ?></a> </li> <?php endwhile; endif; ?> </ul>
I have started a discussion on this topic over in the Carrington forums: https://groups.google.com/group/carrington-framework/browse_thread/thread/b2da3379c608a5b