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 | |
// get next and prev products | |
// Author: Georgy Bunin (bunin.co.il@gmail.com) | |
// forked from https://gist.github.com/2176823 | |
function ShowLinkToProduct($post_id, $categories_as_array, $label) { | |
// get post according post id | |
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array( | |
array( | |
'taxonomy' => 'product_cat', |
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 | |
/** | |
* [list_searcheable_acf list all the custom fields we want to include in our search query] | |
* @return [array] [list of custom fields] | |
*/ | |
function list_searcheable_acf(){ | |
$list_searcheable_acf = array("title", "sub_title", "excerpt_short", "excerpt_long", "xyz", "myACF"); | |
return $list_searcheable_acf; | |
} |
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 Demand Image Sizing -- | |
Experimental code for generating custom image sizes on demand. | |
http://wordpress.stackexchange.com/a/124790 | |
From the author... | |
"When an image is then requested in a particular size, | |
which is not yet generated, it will be created only that once." | |
====================================================================================== */ |
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 | |
/** | |
* Plugin Name: BP Add Page | |
* Plugin URI: https://webdevstudios.com | |
* Description: Example on adding a page to BuddyPress profiles | |
* Author: WebDevStudios | |
* Author URI: https://webdevstudios.com | |
* Version: 1.0.0 | |
* License: GPLv2 | |
*/ |
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 | |
/* Wordpress Custom Search by title, ACF, post_meta */ | |
// Wordpress ?s= redirect to /search/ | |
function wpa_search_redirect() { | |
global $wp_rewrite; | |
if (!isset($wp_rewrite) || !is_object($wp_rewrite) || !$wp_rewrite->using_permalinks()) { return; } | |
$search_base = $wp_rewrite->search_base; | |
if (is_search() && !is_admin() && strpos($_SERVER['REQUEST_URI'], "/{$search_base}/") === false) { | |
wp_redirect(home_url("/{$search_base}/" . urlencode(get_query_var('s')))); |
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 | |
/* | |
You need to authorize your app with scope=public_content | |
Example: | |
https://api.instagram.com/oauth/authorize/?client_id=YOUR_CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=token&scope=public_content | |
*/ | |
$get_my_insta = instagram_feed('USERNAME', 'APP_IP', 'ACCESS_TOKEN', 10); | |
if ( $get_my_insta ) { |
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
find . -type f -exec chmod 644 {} + | |
find . -type d -exec chmod 755 {} + | |
#fix for wp-config.php and index.php | |
find . -name "wp-config.php" -exec chmod 444 {} + |
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
//Custom Autocomplete | |
add_action('wp_ajax_nopriv_get_listing_names', 'ajax_listings'); | |
add_action('wp_ajax_get_listing_names', 'ajax_listings'); | |
function ajax_listings() { | |
global $wpdb; //get access to the WordPress database object variable | |
//get names of all taxonomy terms | |
$name = '%'.$wpdb->esc_like(stripslashes($_GET['name'])).'%'; //escape for use in LIKE statement | |
$sql = "SELECT term.term_id as id, term.name as post_title, term.slug as guid, tax.taxonomy FROM $wpdb->term_taxonomy tax |
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 | |
/** | |
* Shop Custom Permalinks | |
* Remove 'product' slug from Product permalink | |
* Remove 'product-category' slug from Product Category term link | |
* @author vovadevelopenko | |
*/ | |
defined( 'ABSPATH' ) || exit; | |
/** |
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
//short code to get the woocommerce recently viewed products | |
<?php function custom_track_product_view() { | |
if ( ! is_singular( 'product' ) ) { | |
return; | |
} | |
global $post; | |
if ( empty( $_COOKIE['woocommerce_recently_viewed'] ) ) | |
$viewed_products = array(); |
OlderNewer