Shortcode inserts paragraphs before and after executing shortcode

I think this is the result of wpautop filter running on the_content. You can remove this filter from the content: remove_filter(‘the_content’, ‘wpautop’); // OR if the above line does not work: add_filter(‘the_content’, ‘remove_autop’, 1); function remove_autop($content) { remove_filter(current_filter(), ‘wpautop’); return $content; } Or you can use shortcode_unautop filter, but this will only work if your … Read more

Related post using post title

A simple WP_Query with an s argument will search the post title and the post content: $args = array( ‘post_type’ => ‘post’, ‘s’ => ‘keyword’ ); $query = new WP_Query($args); var_dump($query->request); But you could further restrict that with one of several filters: function restrict_search($search,$s) { remove_filter(‘posts_search’,’restrict_search’); global $wpdb; return $wpdb->prepare(” AND {$wpdb->posts}.post_title LIKE ‘%%%s%%’ “,$s->query[‘s’]); … Read more

Last Login in number of days format

Okay, there are a couple of things to do: Get last_active for the user Calculate the days since last_active Set last_active_days_ago for the user So you can go like this: function daysAgo( $time ) { $time = time() – $time; $daysAgo = $time / 86400; // calculate days return $daysAgo; } function set_user_last_active_days_ago( $user_id ) … Read more

Translation of theme using child theme

You are using weird quotes: load_child_theme_textdomain( ‘ifeaturepro5-child’, get_stylesheet_directory() . ‘/languages’ ); } add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ ); use this: load_child_theme_textdomain( ‘ifeaturepro5-child’, get_stylesheet_directory() . ‘/languages’ ); } add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ );

Problem only while using require_once() within functions.php

I noticed the URL of the custom Dashboard page is this… themes.php?page=functions-test.php Notice how the page is the name of my external functions in includes/functions-test.php. The problem is in this line, the one that refreshes the page just before the permission error… echo ‘<meta http-equiv=”refresh” content=”0;url=themes.php?page=functions.php&saved=true”>’; Now it seems so obvious. Look at the page … Read more

How to load jQuery in the footer – nothing works for me

You need to load your scripts in the footer so you’ll need to add them to the functions. This method works for parent themes dependent on jQuery. For child themes Change: get_template_directory_uri() To get_stylesheet_directory_uri() Example code for parent themes: function wpsites_load_scripts() { wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true ); } add_action( ‘wp_enqueue_scripts’, ‘wpsites_load_scripts’ … Read more