Tuesday, 11 August 2020

How To Search In PHP Array Element Containing String | Like Binod


$example = array(
        "who" => "Who is Binod?",
        "name" => "Dose Binod Tharu is Binod?",
"where" => "Where is Binod?",
"whose" => "Whose name is binod?",
"YouTube" => "Dose Binod in the YouTube?",
"meaning" => "What is Binod meaning?",
"fullform" => "What is Binod full form?",
"pronunciation" => "What is Binod pronunciation?",
"english" => "Dose Vinod in english",
"how" => "How to write Vinod in sanskrit?",
"nickname" => "Which best nickname for Vinod?",
"kon" => "Binod kon he?",
"kaha" =>"Binod kaha he?",
"kiska" =>"Binod kiska name he?"
);

$searchword = 'Binod';

$search_results = array_filter($example, function($var) use ($searchword) {
return preg_match("/\b$searchword\b/i", $var); 
});

echo "Search Word: ".$searchword;
echo "<br>Search Results";
echo "<pre>";
echo "Total Search: ".count($search_results);
echo "<hr>";
print_r($search_results);
echo "</pre>";

OutPut:

Wednesday, 5 August 2020

How To Create A Navigation Menu In WordPress?

There are very simple steps to Create A Navigation Menu in WordPress.

1. You need to go in the Appearance » Menus page in your WordPress admin dashboard. 2. You can choose the pages you want to add to the menu. 3. Menu Settings » Select Display location. 4. Save menu. 5. You can see on your WordPress Website after refreshing any page. 

You can see Create A Navigation Menu tutorial on the below Video.


Thursday, 11 June 2020

I want to remove shortcode from content [vc_row][vc_column][vc_column_text]

$content = get_the_content(); 
$content = preg_replace("~(?:\[/?)[^/\]]+/?\]~s", '', $content);
$content = wp_strip_all_tags($content);
echo $content; 

### OR ###

$content = get_the_content(); 
$content = do_shortcode($content);
echo $content;

Monday, 1 June 2020

How To Disable Automatic Updates in WordPress by Custom Plugin?


Using a simple plugin.

Did you know about automatic updates on the WordPress website?

Some time Some Core, Plugins, and Themes are auto-update in your live WordPress site.
That time you lose some custom changes and some other setting in your site.

How to prevent this type of loss and stop auto-update?
Let's follow these simple 4 steps:
1. Download the simple plugin WP Disable Automatic Updates
2. Upload in your WordPress site.
a. Go to in your Wordpress backend wp-admin menu > Plugins > Installed Plugins
b. Click on Plugin Add new button
c. Upload WP Disable Automatic Updates plugin (Not see any update list)
3. Active WP Disable Automatic Updates Plugin
4. Check-in Dashboard > Updates

Note: If you want to check any update in your WordPress site. You need to deactivate WP Disable Automatic Updates Plugin.










Monday, 18 May 2020

The best way to detect a mobile device



<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var isMobile = false;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code write for mobile device...
isMobile = true;
}else{
isMobile = false;
}
</script>
</head>
<body>
<div>
<center><h1 id="device"></h1></center>
</div>
<script>
if(isMobile){
jQuery("#device").text("This is mobile device...");
}else{
jQuery("#device").text("This is not mobile device...");
}
</script>
</body>
</html>



Output:

This is...