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>  

A basic example contact from in php and store data from it

A basic example contact from in php and store data from it //contact form in php page <form id=”contact-form” method=”post” action=””> <h2>Contact Us</h2> <div class=”row two-col”> <div class=”first-col”> <label>First Name</label> <input type=”text” name=”firstname” class=”contact-firstname”> <i class=”first-i”></i> </div> <div class=”second-col”> <label>Last Name</label> <input type=”text” name=”lastname” class=”contact-lastname”> <i class=”last-i”></i> </div> </div> <div class=”row two-col”> <div class=”first-col”> <label>Email</label> […]