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’ );

How to show only one category in breadcrumb navigation

get_the_category() function used to retrieve categories array of a post, and array_shift() function used to get the first item of an array. You possibly need this – function ux_breadcrumbs() { if (!is_home()) { echo ‘<a href=”‘; echo get_option(‘home’); echo ‘”>’; bloginfo(‘name’); echo “</a> » “; if (is_category() || is_single() ) { if( is_category() ) { … Read more

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