Create new post with meta data using WordPress API

You need to register your meta field first, then you can insert / update it into a post using rest api. https://codex.wordpress.org/Function_Reference/register_meta $object_type=”post”; $args1 = array( ‘type’ => ‘string’, ‘description’ => ‘My Meta Key Description’, ‘single’ => true, ‘show_in_rest’ => true, ); register_meta( $object_type, ‘MyMetaKey’, $args1 ); Hope it helps

Display only past events on that page using Visual Composer Grid Bulider

Finally i got answer. post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&‌​meta_query%5B0%5D%5B‌​value%5D=$today&‌​meta_query%5B0%5D%5B‌​compare%5D=%3C&meta_‌​query%5B0%5D%5Btype%‌​5D=DATE post_type=event&meta_query%5B0%5D%5Bkey%5D=date_short_order&‌​meta_query%5B0%5D%5B‌​value%5D=$today&‌​meta_query%5B0%5D%5B‌​compare%5D=%3C&meta_‌​query%5B0%5D%5Btype%‌​5D=DATE

Create WordPress shortcode with php code inside

Creating a shortcode is fairly simple, it only needs a shortcode name and maybe some arguments. Here is a simple one for you: add_shortcode(‘my-shortcode’,’my_shortcode_function’); function my_shortcode_function(){ return ‘<div id=”search-nacionalidad”><p class=”‘. get_field(‘nacionalidad’).’ noselect” title=”‘.get_field(‘nacionalidad’).'” alt=”‘. get_field(‘nacionalidad’).'”>’.get_field(‘nacionalidad’).'</p></div>’; } Now, using [my-shortcode] exactly does what your code does. However I’m not sure how do you use this, whether … Read more

Carbon Fields use in custom plugin class

I found the answer to my question. From the part, the problem was that I connected the vendor/autoload.php after accessing the __construct(). An example of solving this task below use Carbon_Fields\Container; use Carbon_Fields\Field; class PluginOption { public function __construct() { require_once( ‘vendor/autoload.php’ ); \Carbon_Fields\Carbon_Fields::boot(); add_action( ‘carbon_fields_register_fields’, array( $this, ‘crb_attach_theme_options’) ); } public function crb_attach_theme_options() { … Read more