by Garth | May 21, 2018 | PHP, Wordpress
Calling your Query While or Foreach While <?php $query = new WP_Query($args); ?> <?php while ( $query->have_posts() ) : the_post(); ?> <div> <?php $query->the_post(); get_template_part( ‘content’, get_post_format() ); ?>...
by Garth | May 18, 2018 | PHP, Plugins, Wordpress
This post requires developer discretion. The file names are written as an example for this post. As long as you make sure your files are been linked up correctly, you can name your files whatever you like. There’s loads of comments to help you along the way. You...
by Garth | May 18, 2018 | PHP, Wordpress
function my_admin_menu() { $page_title = ‘Clear Stock’; $menu_title = ‘Clear Stock’; $capability = ‘manage_options’; $menu_slug = ‘/clear_stock’; $function = ‘clear_stock’; $icon_url = ”; $position =...
by Garth | May 11, 2018 | PHP
<?php echo date_default_timezone_set(‘UTC’); /* The terrminology for this function h : 12 hour format H : 24 hour format i : Minutes s : Seconds u : Microseconds a : Lowercasw am or pm l : Full text for the day F : Full text for the month j : Day of the...
by Garth | May 10, 2018 | PHP, Wordpress
// Clear Stock function clear_current_stock(){ // Declare the $wpdb var global $wpdb; // Run My SQL Query (My Query is setting the meta value for stock to zero) $wpdb->query(“UPDATE wp_postmeta SET meta_value = 0 WHERE meta_key = ‘_stock'”); // Check...
by Garth | May 8, 2018 | PHP, Wordpress
<?php $user_id = get_current_user_id(); if (!empty($user_id)) { $user = wp_get_current_user(); $role = ( array ) $user->roles; // echo $role[0]; if ($role[0] == ‘free-client’ OR $role[0] == ‘administrator’) { //code here… } }...