Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

post-meta

Echo 2 values from one key in Array with get_post_custom

The main problem with your code is that you only store the value and not the venue name a simple fix would be to change your vlaue to hold the venue name as well , something like: array( ‘name’ => ‘Venue’, ‘desc’ => ‘Venue of Event’, ‘id’ => $prefix . ‘event_venue’, ‘type’ => ‘radio’, ‘options’ … Read more

Categories metabox Tags array, metabox, post-meta

Media attachment date and post date

Iterate over all posts, find the attached images … $images =& get_children( array ( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’ ); … and for each image use wp_update_post() to set the date from the parent post.

Categories media-library Tags date, date-time, media-library, post-meta, uploads

How do I add a fixed value to get_post_meta();?

<?php $tag = get_post_meta($post->ID, ‘wikipedia’, true); ?> <?php if (isset($tag) && $tag != ”) : ?> <a href=”https://wordpress.stackexchange.com/questions/36825/wikipedia.org/wiki/<?php echo $tag; ?>” title=”Wiki this!”>Wikipedia</a> <?php endif; ?> To explain it a bit: First you put the data in a variable, then if the variable has some data, it will show the link and echo the data … Read more

Categories post-meta Tags post-meta

Problem Saving Custom Post Type Meta Values

$article_date = $custom[“tf_book_author”][0]; $article_date = $custom[“tf_book_afirst”][0]; $article_date = $custom[“tf_book_isbn”][0]; $article_date = $custom[“tf_book_dts”][0]; $article_date = $custom[“tf_book_price”][0]; This is your issue. You need to set these to $tf_book_author and such, especially if you’re going to echo them. I stopped there, so there may be more errors in the code, but that’s the first one to knock out.

Categories custom-post-types Tags custom-post-types, post-meta

Custom Query: query by post custom meta data

Since you’re using WP_Query(), you should consult the Codex entry for WP_QUery(). It lists all of the parameters that can be passed to the arguments array. In this case, you want to use the post custom meta parameters. Assuming your custom meta key is _show_on_front, and your value is true or false: <?php $custom_query_args = … Read more

Categories custom-field Tags custom-field, post-meta, query

Drag and Drop Metadata Menu Order

This is a complex answer, more than can really be answered in a post here. However, you can take a look at this tutorial – I’ve done something similar, and his post is very thorough: jQuery UI Sortable Tutorial

Categories jQuery Tags jquery, jquery-ui, meta-query, post-meta

How to order custom posts by one of the custom fields value, ‘date’?

the best way If you input the gig time as a unix timestamp (using strtotime()), then you can use WP_Query‘s meta_value_num in the orderby element to set the order. You can also use WP_Query‘s meta_query to only get posts that have a date that occur in the future. the other way If you can’t do … Read more

Categories custom-post-types Tags custom-post-types, post-meta

Building tags and archive using meta from custom post type

I’d recommend something like the following: Slurp up a list of all of the distinct meta values corresponding to the start date meta_key. I don’t see a WP function that does this, so you’ll have to do something like the following: $start_dates = $wpdb->get_col( $wpdb->prepare( “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s”, ‘start_date’ … Read more

Categories custom-post-types Tags custom-post-types, post-meta

Adjust query on single

Take a look here: specify meta_key / meta_value condition for prev_post_link and next_post_link Which ultimately leads to this plugin, which accesses the get_adjacent_post function mentioned above: Ambrosite Next/Previous Post Link Plus And looks like it would fit your needs by allowing you to specificy a meta_value for the next/prev post hook.

Categories plugin-development Tags metabox, plugin-development, post-meta, theme-development, wp-query

WordPress stripping out custom field tags

Change above code to like this: <?php $cast_members = get_post_meta($post->post_parent, ‘cast_members’, true); ?> <p><?php echo wpautop($cast_members); ?></p> <?php endif; ?> in this code wpautop() function automatically adds p tag for cast members.

Categories PHP Tags custom-field, php, post-meta
Older posts
Newer posts
← Previous Page1 … Page77 Page78 Page79 … Page204 Next →
+ More

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 2026 Read For Learn
Next Page »
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress