Customizing the display of custom post types

This sounds quite a bit like the Advanced Custom Fields flexible content field. Basically it works by letting you setup a number of different templates for how you might want to create/display your page. Then when you are in the editor, you pick which template you want to use. More info here: http://www.advancedcustomfields.com/resources/field-types/flexible-content/

Formating content in category.php

You might try the the_content filter with the conditional tag is_category() to append a string to the post content when viewing the category archives : add_filter( ‘the_content’, ‘custom_the_content’ ); function custom_the_content( $content ){ if( is_category() ): $metastime = get_post_meta( get_the_ID(), ‘user_submit_starttime’, true ); $metaetime = get_post_meta( get_the_ID(), ‘user_submit_endtime’ , true ); $metaloc = get_post_meta( get_the_ID(), … Read more

Metabox nonce not allowing update

The issue was that you should have changed product_noncename to goal_info_meta_box_nonce. I’ve also made a few other changes, commenting out the old lines for comparison, which should avoid any further errors (including the undefined index). // verify nonce // if ( ! isset( $_POST[‘product_noncename’] ) || ! wp_verify_nonce( $_POST[‘goal_info_meta_box_nonce’], basename( __file__ ) ) ) { … Read more

WP_Query based on multiple metadata comparisons

You could split this into two WP_Querys: $args = array( ‘post_type’ => ‘match_report’, ‘post_status’ => ‘publish’, ‘meta_key’ => ‘report_type’, ‘meta_value’ => ‘cup’, ‘fields’ => ‘ids’ ); $reportsPre = new WP_Query($args); $post_IDs = array(); if(isset($reportsPre->posts) && !empty($reportsPre->posts)){ foreach((array) $reportsPre->posts as $id) { $post_IDs[] = $id; } } $args2 = array( ‘post__in’ => array($post_IDs), ‘meta_query’ => array( … Read more

Custom field in a shortcode?

$post is global variable, so it’s not visible in this scope (and when you use $post in your code, you’re not referring to global $post variable but to local one) You should put global $post somewhere in your code. For example like this: … while ($loop->have_posts()){ global $post; $loop->the_post(); $output .= ‘<li><a href=”‘.get_permalink().'”><img src=”‘.get_post_meta($post->ID,’wpcf-udstiller-logo’,true).'”/></a></li>’; } … Read more

WP Post Meta Box Field Not Showing Updated Field

There is problem in your show_the_meta_box() function you have used value attribute for the textarea field don’t use value attribute for textarea field. For more information on textarea atrributes visit this page. So the correct code show_the_meta_box() function is as shown in following. function show_the_meta_box() { global $meta_box_code, $post; echo ‘<input type=”hidden” name=”id_meta_box_nonce” value=”‘. wp_create_nonce( … Read more

Select Menu for Custom post Type does not save

This is a javascript issue. on line 52: $ret .= ‘<script>jQuery(document).ready(function(){ jQuery(“#videotype”).val(‘ . get_video_field(“videotype”) . ‘) });</script></div>’; In this specific bit: .val(‘ . get_video_field(“videotype”) . ‘) The value isn’t quoted, so it’s trying to reference a variable named youtube or vimeo, which doesn’t exist, instead of a literal text value. If you add quotes it’ll … Read more

Returning website screenshot based on Custom Field

i think there is an error – <img src=”https://wordpress.stackexchange.com/questions/105525/<?php echo”http://s.wordpress.com/mshots/v1/’.urlencode(the_field(‘website’); ‘).’?w=200′ ?>” /> it should be <img src=”https://wordpress.stackexchange.com/questions/105525/<?php echo”http://s.wordpress.com/mshots/v1/’.urlencode(the_field(‘website’).’?w=200′ ?>” alt=”” /> And if this not work. I think you use the_field(‘website’) function which actually not return result you can try this code. <img src=”https://wordpress.stackexchange.com/questions/105525/<?php echo”http://s.wordpress.com/mshots/v1/’.urlencode(get_the_field(‘website’).’?w=200′ ?>” alt=”” />

Order by custom field in query multiple

You need ‘order_by’ => ‘post__in’ in the last query in order to “Preserve post ID order given in the post__in array (available with Version 3.5).”. I don’t know if the order you are passing in is the order you want after the array_merge( $group_1, $group_2). In other words, you need to feed that second query … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)