This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Category name(‘shirt’, ‘tshirt’, ‘pant’) which not to want display products on the shop page | |
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' ); | |
function custom_pre_get_posts_query( $q ) { | |
if ( ! $q->is_main_query() ) return; | |
if ( ! $q->is_post_type_archive() ) return; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_enqueue_script('jquery'); | |
if (!function_exists('load_theme_scripts')) { | |
function load_theme_scripts(){ | |
wp_enqueue_script( 'custom-script', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.0', true ); | |
} | |
add_action("wp_enqueue_scripts", "load_theme_scripts"); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On contact form 7 editor’s Additional Settings field section, just add this code. | |
on_sent_ok: "location = 'http://example.com/';" | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (is_user_logged_in() ): ?> | |
<a href="<?php echo wp_logout_url() ?>" title="Logout">Logout</a> | |
<?php else: ?> | |
<a href="http://example.com/wp-login.php" title="Logout">Member Login</a> | |
<?php endif ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function options_page_function_name(){ | |
add_options_page( 'manu_title', 'menu name', 'manage_options', 'option-page', 'another_page_function_name', plugins_url( 'plugin_folder_name/images/icon.png' ),8 ); | |
} | |
add_action('admin_menu','options_page_function_name'); | |
// 4. Add setting option by used function. | |
function register_settings_function_name() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Single shortcode====== | |
function single_shortcode( $atts, $content = null ) { | |
return '<div class="singe_shortcode_wrapper">'.do_shortcode($content).'</div>'; | |
} | |
add_shortcode('single_shortcode', 'single_shortcode'); | |
=========Shortcode with attributes======== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Plugin information | |
/* | |
Plugin Name: Your plugin Name | |
Plugin URI: http://example.com/pluginsurl | |
Description: Given your plugin description here. | |
Author: Author Name | |
Version: 1.0 | |
Author URI: http://example.com/ | |
*/ | |
//The latest jquery need to use every plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_bar_menu', 'wp_admin_bar_my_custom_account_menu', 11 ); | |
function wp_admin_bar_my_custom_account_menu( $wp_admin_bar ) { | |
$user_id = get_current_user_id(); | |
$current_user = wp_get_current_user(); | |
$profile_url = get_edit_profile_url( $user_id ); | |
if ( 0 != $user_id ) { | |
/* Add the "My Account" menu */ | |
$avatar = get_avatar( $user_id, 28 ); |