Display post meta on edit page in admin

I found the answer: add_action(‘add_meta_boxes’, ‘add_contact_form_meta_box’); function add_contact_form_meta_box() { add_meta_box(‘contact-form-meta-box-id’, ‘Submission Data’, ‘contact_form_meta_box’, ‘contact_form’, ‘normal’, ‘high’); } function contact_form_meta_box($post) { echo get_post_meta($post->ID, ‘first_name’, true); }

Shortcode for display posts in wp-editor

Declaring a shortcode is as easy as using this: add_shortcode(‘jobs’, ‘callback_function’); function callback_function(){ $content=””; $args = array( ‘post_type’ => array(‘job’), ‘posts_per_page’ => 20 ); $the_query = new WP_Query( $args ); if ($the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); if ( 683 !== get_the_ID() ) { $content .= ‘<a href=”‘. get_the_permalink().'” class=”jobs”>’; } $content … Read more

One-to-many post relationships that are displayed by category (using posts-to-posts plugin)

I’m not that familiar with the posts-to-posts Plugin, but your main problem may be that the category page doesn’t know which building you chose in the step before if you don’t transmit it in a parameter or save it in a session or cookie. Maybe it would be better to output the connected items on … Read more

Get custom fields from a custom post type with a shortcode

Get the Attribute value in the shortcode and get the custom field values: function product_func($atts) { $post_id = $atts[‘code’]; $key = “my_custom_field_key”;//for 1 field, you can do this 6 times for the 6 values $custom_value = get_post_meta($post_id, $key, true); return $custom_value; } add_shortcode(‘product’, ‘product_func’); if you want to debug the post meta field values use … Read more

Dequeue scripts and styles only for specific custom post type

You are missing the {…} around the calls to wp_dequeue_script. That means only the first one is associated with the if statement, and the rest are being executed for every case. Update your code to the following: add_action( ‘wp_enqueue_scripts’, ‘dequeue_my_scripts’, 999 ); function dequeue_my_scripts() { if ( ‘guide’ == get_post_type() ) { wp_dequeue_script( ‘dw_focus’ ); … Read more