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 custom_query_shortcode($atts) { | |
// EXAMPLE USAGE: | |
// [loop the_query="showposts=100&post_type=page&post_parent=453"] | |
// Defaults | |
extract(shortcode_atts(array( | |
"the_query" => '' | |
), $atts)); |
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
/** | |
* Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :) | |
* source: https://github.com/herewithme/wp-filters-extras | |
* More: http://wordpress.stackexchange.com/questions/57079/how-to-remove-a-filter-that-is-an-anonymous-object | |
*/ | |
function remove_filters_for_anonymous_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) { | |
global $wp_filter; | |
// Take only filters on right hook name and priority | |
if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) ) |
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
Best way to override a plugin function is to use mu-plugins (Must Use Plugins) | |
https://gregrickaby.com/2013/10/create-mu-plugin-for-wordpress/#comment-14420 | |
Aleternatively, follow below : | |
1. Copy the plugin shortcode function and put it anywhere in Child Theme and rename it like custom_cs_user_login_shortcode. | |
2. use 'wp_head' action to remove the plugin shortcode and register the new shortcode again with the new function name like custom_cs_user_login_shortcode. | |
/********************************************* |
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 delete_posts() { | |
$args = array ( | |
'post_type' => 'lionfish_locations', // post type | |
'nopaging' => true | |
); | |
$q = new WP_Query ($args); | |
while ($q->have_posts()) { | |
$q->the_post(); | |
$id = get_the_ID(); | |
$posted_time = human_time_diff(get_the_time('U'), current_time ('timestamp')); |
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
// Shortcode | |
// source : https://wpbakery.atlassian.net/wiki/pages/viewpage.action?pageId=524362 | |
if(!function_exists('carousel_content')){ | |
function carousel_content( $atts, $content = null ) { | |
return '<div class="owl-carousel content-carousel content-slider">'.do_shortcode($content).'</div>'; | |
} | |
add_shortcode('carousel_content', 'carousel_content'); | |
} |
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
/* localize script */ | |
wp_enqueue_script( 'settings', get_template_directory_uri() . '/js/settings.js', array('jquery'), OO_Version, true ); | |
wp_localize_script( 'settings', 'localized', array( | |
'ajaxurl' => admin_url( 'admin-ajax.php' ) | |
)); | |
/* setting.js */ | |
jQuery(function($){ |
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
/**************************************************************** | |
Project: MySavingWallet | |
Resource: http://www.ibenic.com/wordpress-file-upload-with-ajax/ | |
HTML FORM | |
*****************************************************************/ | |
<dt><?php esc_html_e( 'Support Doc', 'listify_child' ); ?></dt> | |
<dd> | |
<section> |
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
/** | |
* get youtube video ID from URL | |
* http://stackoverflow.com/questions/6556559/youtube-api-extract-video-id | |
* @param string $url | |
* @return string Youtube video id or FALSE if none found. | |
*/ | |
function youtube_id_from_url($url) { | |
$pattern = | |
'%^# Match any youtube URL | |
(?:https?://)? # Optional scheme. Either http or https |
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
/* | |
Site sample: http://nysi.co/ | |
*/ | |
(function($) { | |
"use strict"; | |
jQuery(document).ready(function($) { | |
$('#slider').slick({ | |
centerMode: true, |
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
/*************************************************** | |
USING add_rewrite_rule | |
****************************************************/ | |
/* azizultex | |
1. https://www.ait-themes.club/knowledge-base/how-can-i-change-items-slug-and-slug-of-other-custom-post-types/ | |
2. http://wordpress.stackexchange.com/questions/41988/redeclare-change-slug-of-a-plugins-custom-post-type | |
3. http://wordpress.stackexchange.com/questions/134322/rewrite-rule-for-custom-taxonomy | |
*/ |
NewerOlder