HOME / BLOG

How To Create A plugin In wordpress?

Create A plugin In WordPress Paste this code in the php file with the same name of your plugin folder <?php /* Plugin Name: My First Plugin Description: This is my first plugin in wordpress. version: 1.0 Plugin URI: https://amitpalsingh.com Author: Sandip Das Author URI: https://amitpalsingh.com */ ?>  

How to create a table with wordpress custom plugin?

Create a table with WordPress custom plugin <?php function my_first_plugin_code(){ /* create table */ global $wpdb; $charset_collate = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . “myplugintable”; $sql = “CREATE TABLE $table_name ( id mediumint(9) NOT NULL AUTO_INCREMENT, time datetime DEFAULT ‘0000-00-00 00:00:00’ NOT NULL, name tinytext NOT NULL, text text NOT NULL, url varchar(55) DEFAULT ” NOT […]

Can I override the values loaded by add_theme_support in function.php?

Problem: I’m setting up a site based on the Twenty Seventeen theme and that theme includes in its function.php file a section to set the size of the custom-logo: //code add_theme_support( ‘custom-logo’, array( ‘width’ => 250, ‘height’ => 250, ‘flex-width’ => true, ) ); The site’s logo is 946 wide by 250 high. It is […]

How to get post content by usingpost id in wordpress?

Get post content by usingpost id in wordpres function custom_content($post){ $my_postid = 6;//This is page id or post id $content_post = get_post($my_postid); $content = $content_post->post_content; $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]&gt;’, $content); echo $content; }  

How to create a short code in wordpress?

Create a short code in wordpress function my_shortcode() { //buffering //Object Start ob_start(); date_default_timezone_set(‘asia/kolkata’); //echo date(‘H:i:s’); echo ‘<div id=”mytime”></div>’; // object get contents $output_string = ob_get_contents(); // clean object ob_end_clean(); return $output_string; } add_shortcode(“clock”,”my_shortcode”);  

How to get default time by using php?

Get default time by using php date_default_timezone_set(‘asia/kolkata’); <div id=”mytime”>echo date(‘H:i:s’);</div>