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 | |
add_rewrite_rule( | |
'^result/([^/]*)/?([^/]*)$', | |
'index.php?pagename=result&style_slug=$matches[1]&gender_slug=$matches[2]', | |
'top' ); | |
add_rewrite_tag('%style_slug%','([^/]*)'); | |
add_rewrite_tag('%gender_slug%','([^/]*)'); |
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
/* | |
############################## | |
########### Search ########### | |
############################## | |
Included are steps to help make this script easier for other to follow | |
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10 | |
I also updated this work to include XSS and SQL injection projection | |
[list_searcheable_acf list all the custom fields we want to include in our search query] | |
@return [array] [list of custom fields] |
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 | |
/** | |
* Shortcode for displaying a link from the ACF Link Picker addon. | |
* | |
* Usage: | |
* [acf_link_picker] | |
* -or- | |
* [acf_link_picker field="myfield"] | |
*/ | |
add_shortcode( 'acf_link_picker', function ( $atts, $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
<?php if ( get_field( 'field_name' ) ): ?> | |
This is displayed when the field_name is TRUE or has a value. | |
<?php else: // field_name returned false ?> | |
This is displayed when the field is FALSE, NULL or the field does not exist. | |
<?php endif; // end of if field_name logic ?> |
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 | |
/* Pull apart OEmbed video link to get thumbnails out*/ | |
function get_video_thumbnail_uri( $video_uri ) { | |
$thumbnail_uri = ''; | |
// determine the type of video and the video id | |
$video = parse_video_uri( $video_uri ); | |
// get youtube thumbnail |
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 | |
/* Instant Articles (https://wordpress.org/plugins/fb-instant-articles/) - Use post excerpt as subtitle */ | |
add_filter( 'instant_articles_subtitle', 'hf_instant_articles_subtitle' ); | |
function hf_instant_articles_subtitle( $subtitle ) { | |
$excerpt = get_the_excerpt(); | |
if ( trim($excerpt)!='' ) $subtitle = trim($excerpt); | |
return $subtitle; | |
} |
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 | |
/** | |
* Infinite next and previous post looping in WordPress | |
*/ | |
if( get_adjacent_post(false, '', true) ) { | |
previous_post_link('%link', '← Previous Post'); | |
} else { | |
$first = new WP_Query('posts_per_page=1&order=DESC'); $first->the_post(); | |
echo '<a href="' . get_permalink() . '">← Previous Post</a>'; | |
wp_reset_query(); |
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 Query Comprehensive Reference. | |
* | |
* All credits go to luetkemj. Thanks! | |
* | |
* @author luetkemj <luetkemj@gmail.com> | |
* @author s3rgiosan <me@s3rgiosan.com> | |
* | |
* @see http://codex.wordpress.org/Class_Reference/WP_Query#Parameters |
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 | |
/** | |
* Contact Form 7 - Conditionally Chance Recipient to Post Meta | |
* | |
* This function gets the current post id and grabs the desired meta to use | |
* it on the submited form data to change the recipient email conditionally. | |
* You can add some conditional checks to make sure the data is correct. | |
* | |
* @author António Pinto <apinto@vanguardly.com> | |
* @link https://gitlab.com/snippets/1662384 |
OlderNewer