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

How can i put a custom field inside this php

Assuming that your date format – for whatever reason – really is yymmdd instead of being set to what you defined in the admin settings section: There’s the native PHP function date_parse_from_format() that you can use in conjunction with the core setting. Just add the following plugin and use the custom Template Tag in your … Read more

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

Update an existing post in a custom post type

Solved.. I did it in 2 steps and it works perfectly! if(isset ($_POST[‘new_title’]) && $_POST[‘new_title’] != “”) { $post_type = get_post_type( get_the_ID() ); $id_post = get_the_ID(); $title = get_field(‘titre’); $postInfo = array( ‘post_type’ => $post_type, ‘ID’ => $id_post ); $id = wp_update_post($postInfo); update_post_meta( $id, ‘titre’, $_POST[‘new_title’] ); $new_title = $_POST[‘new_title’]; $new_elem = array( ‘post_type’ => … Read more

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

How to remove post view count

If, as you say, the theme does not provide direct show/hide configuration options, your most typical choices will be, I think: 1) If the theme provides a CSS class enabling targeting of the view count as rendered, to make it disappear via CSS; 2) If the theme provides a filter for rendering the view count, … Read more

Categories CSS Tags css, post-meta

Using Form to alter PHP variable [closed]

Don’t put your variables in single quotes. This: if(isset($submit)){ $args = array( ‘numberposts’ => 10, ‘meta_key’ => ‘$filter’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘DESC’, ‘post_type’ => ‘things’, ‘post_status’ => ‘publish’ ); $mystuff = get_posts( $args ); $name = $filter ; } Should be this: if(isset($submit)){ $args = array( ‘numberposts’ => 10, ‘meta_key’ => $filter, ‘orderby’ … Read more

Categories post-meta Tags forms, post-meta, variables

Limiting the amount of posts this displays

You have posts_per_page = -1, which means show unlimited posts. Change the -1 to the number of posts you want to appear. Also you have output that skips if your “next_open_day” meta value is null, but the query will only run 3 times, so you need to move that logic into the query itself by … Read more

Categories query-posts Tags post-meta, query-posts

Problem with get_post_meta

I was having some issues like yours. It was because it was on a page template with a query above it. All I had to do was reset the query.

Categories post-meta Tags post-meta

query with custom field

A quick google search would have directed you to this page: http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters

Categories post-meta Tags post-meta

Order by a meta field in query loop

<?php $cat = get_post_meta( get_the_ID(), ‘cat_page’, true ); $args = array( ‘category_name’ => $cat, ‘meta_key’ => ‘niveau_chiffre’, ‘orderby’ => ‘meta_value_num’, //Since we’re dealing with numbers ‘order’ => ‘ASC’, //’meta_query’ => array( // array( //’key’ => ‘niveau-chiffre’, //’value’ => ‘niveau-chiffre’, Don’t give a value because we’re not looking for a specific one //’compare’ => ‘>=’, We’re … Read more

Categories custom-field Tags custom-field, loop, post-meta, sort

add multiple values (array) to post meta_input

You can simply store the meta as an array… Also to hell with add_post_meta… I never use it. update defaults to add if the meta doesn’t exist for the post. update_post_meta($post_id, “_event_musikstil”, $event_musikstil); wordpress will store the value as a serialized array then so just retrieve it like get_post_meta($post_id, “_event_musikstil”, TRUE); Hope this helps. Another … Read more

Categories custom-field Tags custom-field, post-meta, wp-insert-post

custom field with links

Lets go with an example… Custom Field Name: buy-ticket Custom Field Value: http://example.com/link-to-ticket/ And you said, you want a button called “Buy ticket” linking to the Custom Field Value. This how you do it: <a href=”https://wordpress.stackexchange.com/questions/57443/<?php echo get_post_meta($post->ID,”buy-ticket’, true); ?>” title=”Buy a ticket right away!”> <span>Button text or code here</span> </a> SOURCE: WordPress Codex Function … Read more

Categories custom-field Tags custom-field, post-meta
Older posts
Newer posts
← Previous Page1 … Page7 Page8 Page9 … Page203 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
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 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