Select two value from meta key and post meta

You just need to join postmeta twice: global $wpdb, $bp; $user_id = get_current_user_id(); $query = $wpdb->prepare( “SELECT rel.post_id as id, rel2.meta_value as val FROM {$wpdb->posts} AS posts LEFT JOIN {$wpdb->postmeta} AS rel ON posts.ID = rel.post_id LEFT JOIN {$wpdb->postmeta} AS rel2 ON posts.ID = rel2.post_id WHERE posts.post_type=”books” AND posts.post_title LIKE ‘%%fire’ AND posts.post_status=”publish” AND rel.meta_key … Read more

How to insert widgets into a post?

You can insert widgets into a post by Shortcode. Just make a shortcode with dynamic_sidebar() function to insert your specified sidebar widgets. <?php add_shortcode(‘sidebar_widgets’, function($atts, $content) { ob_start(); $atts = shortcode_atts(array( ‘sidebar_id’ => ”, ),$atts); ?> <div> <?php dynamic_sidebar($atts[‘sidebar_id’]); ?> </div> <?php $html = ob_get_clean(); return $html; }); You can implement this shortcode with any … Read more

Trying to filter tag cloud args, but it removes the wrapper

You’re overwriting the defaults passed to the filter, one of which is echo, which is false by default for the widget. This is because the function that generates the tag cloud has echo equal to true by default, so your tag cloud is getting immediately output instead of returned back to the widget handler.

How to make home widgets appear horizontally

Use CSS3 flexbox to control layout of widgets. First, wrap widget divisions in a container division <div class=”widgets-container”>. Add a unique class to each widget division ( in our example: widget-1, widget-2, and widget-3 ). Example code: <div class=”widgets-container”> <div class=”widget-1″> <!– widget-1 code below –> <h2>Widget 1</h2> </div> <div class=”widget-2″> <!– widget 2 code … Read more

Can’t display custom widget

As noted by Shibi’s comment, you want to use footer_options as your argument to dynamic_sidebar as that is the id you assigned in your code. Keep in mind, both dynamic_sidebar and is_active_sidebar only check for individual sidebars. If you have multiple sidebars (representing neighboring regions) you need to display in your footer, you may need … Read more

WordPress Edit Button not appearing for widget in customizer

You must define a valid element for the before_widget/after_widget when you register a sidebar. In fact, I just a couple days ago added this to the theme handbook on Widgets: Opting-In To Selective Refresh: Important: Selective refresh for widgets requires that the theme include a before_widget/after_widget wrapper element around each widget that contains the widget’s … Read more

WordPress update not saving

The problem is here: $instance[‘content’] = (!empty( $newInstance[‘content’])) ? $oldInstance[‘content’] : ”; This translates to: if newinstance content is not empty and has something in it then use the old instance content else if it is empty use ” Should it not be using new instance instead of old? For example, here’s the example in … Read more

Cannot change footer text?

The original theme url here ( https://wordpress.org/themes/sornacommerce/ ) The theme working by using WordPress hooks You can update this file: sornacommerce\inc\theme-hooks.php on line 438 to 497 Otherwise remove the function on the hook like bellow: remove_action( ‘sornacommerce_site_footer_block’, ‘sornacommerce_site_footer_block’ ); Then add new function to the same hook like bellow: function wpse291732_footer() { // your function … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)