how to call other plugins once custom post has been inserted

I don’t completely understand your question – maybe this will help: wp_insert_post(array( // your woocomm post being inserted )); // at insert, `save_post` will fire add_action( ‘save_post’, ‘my_plugin_save_post’ , 10 , 3 ); function my_plugin_save_post($post_id, $post, $update) { // check other firing of this: if this is a revision, get real post ID if ( … Read more

custom field – changing an element or background of id div – different versions not working

In most themes anything added via the wp_head hook should appear after (and override) enqueued CSS. So you could add an action to the themes functions.php and use get_queried_object_id() for the post ID. function my_dynamic_css() { $custombg = get_post_meta( get_queried_object_id(), ‘custombg’, true ); if (! empty($custombg)) { ?><style>#Box2 {background: <?php echo $custombg; ?> }</style> <?php … Read more

How to create a sub-page of sub-page?

I may be completely misunderstanding your question but I think you’re trying to create something like the image below. Correct? If that’s the case you would create the menu structure either using the “Customize” or the “Menu” option in the “Appearance” menu in WordPress. The you simply arrange menu items the way you want them … Read more

How to sort (orderby) a query done by a template function before the ‘foreach’ loop?

Without knowing what Realia_Post_Type_Property::get_properties() does and returns, this is a bit tricky to answer. But essentially, you want to to sort an array using PHP. Unless Realia_Post_Type_Property::get_properties() allows you to get a sorted list of posts, your best bet is probably to use wp_list_sort(). That function sorts a list of objects, based on one or … Read more

WordPress select query issue

One more for the pot: $wpdb->get_col can be used to return a “single dimensional” array of all values set for “sleeps” global $wpdb; $values = $wpdb->get_col( “SELECT meta_value FROM wp_postmeta WHERE meta_key = ‘sleeps'” ); echo implode(‘,’, array_unique($values) );

Open/closed function [closed]

I’ve sourced the CSS from https://codepen.io/vram1980/pen/Kyaie all credit above. Putting it with your function, you can do something like this: add_shortcode( ‘linestatus’, ‘line_status_handler’ ); function line_status_handler( $atts ) { extract( shortcode_atts( array( ‘open_time’ => ’09:00:00′, ‘closed_time’ => ’17:00:00′, ‘open_text’ => ‘our lines are open’, ‘closed_text’ => ‘our lines are closed’, ), $atts ) ); $opened … Read more

Get Posts by Custom Taxonomy on Custom Post

<?php // get the WP_Query object $query = new WP_Query($args); // Missed essential point: // loop through the WP_Query object // to get the array of distinct posts objects $coaches = $query->posts; // each $coach is distinct post object now foreach( $coaches as $coach ) { // echo $coach->ID; }