emergencyx
Forum Replies Created
-
Save that code in the functions.php file of your wordpress.
nevermind i figured it out using chatgpt. This thing is awesome . code is below:
function count_keywords_in_content($title, $id) {
if (is_search()) {
global $wp_query;
$keyword = $wp_query->query[‘s’];
$content = strip_tags(get_post_field(‘post_content’, $id));
$count = substr_count(strtolower($content), strtolower($keyword)) + substr_count(strtolower(get_post_field(‘post_title’, $id)), strtolower($keyword));
if ($count && strpos($title, ” Times this keyword is shown”) === false) {
$title = $title . ” (” . $count . ” Times this keyword is shown)”;
}
}
return $title;
}
add_filter(‘the_title’, ‘count_keywords_in_content’, 10, 2);- This reply was modified 3 years, 4 months ago by emergencyx.
Forum: Plugins
In reply to: [Post Views Counter] what is the custom field name for the page views?as a follow up question….can someone help me to use searchwp plugin and post views counter to display when you search something the most viewed page based on the keyword over anything else.
Ive been trying to figure it out and everything Ive tried doesnt work.Forum: Plugins
In reply to: [WooCommerce] 5 stars on product page issue with update of WoocommerceTest Website is https://interstellarblendusa.com/products-2/
main site with old version is https://theinterstellarplan.com/products-2/