This file contains hidden or 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 WordPress - Advance Custom Fields Pro | |
<?php | |
$rows_hfbir = get_field('homepage_full_browser_images_repeater'); | |
if($rows_hfbir) { |
This file contains hidden or 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
echo limit_text( get_field('village_finds_report'), 40, get_permalink( get_the_id() ) ); | |
// originally taken from | |
// https://stackoverflow.com/questions/965235/how-can-i-truncate-a-string-to-the-first-20-words-in-php | |
// slightly adjusted to include a url. | |
function limit_text($text, $limit=40, $url='') { | |
if (str_word_count($text, 0) > $limit) { | |
$words = str_word_count($text, 2); | |
$pos = array_keys($words); | |
$text = substr($text, 0, $pos[$limit]) . '...'; |
This file contains hidden or 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 bones_fonts() { | |
wp_enqueue_style('googleFonts', '//fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Nunito:300,300i,400,600,700'); | |
} | |
add_action('wp_enqueue_scripts', 'bones_fonts'); | |
Add to functions.php or separate plugin. |
This file contains hidden or 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
// https://wordpress.stackexchange.com/questions/61244/wp-enqueue-style-on-specific-page-templates | |
function my_enqueue_stuff() { | |
global $template; | |
$template_array = explode('/',$template); | |
if ( end($template_array) == 'single-recipes.php' ) { | |
wp_enqueue_script('jspdf', 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.4/jspdf.debug.js', array(), '20170816', true ); | |
// http://rawgit.com/MrRio/jsPDF/master/docs/ | |
// A library to generate PDFs in client-side JavaScript. |
This file contains hidden or 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 get_all_categories($taxonomy) { | |
$terms = get_terms( | |
array( | |
'taxonomy' => $taxonomy, | |
'hide_empty' => false, | |
) | |
); | |
if ( $terms && ! is_wp_error( $terms ) ) : |
This file contains hidden or 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
// https://stackoverflow.com/questions/965235/how-can-i-truncate-a-string-to-the-first-20-words-in-php | |
function limit_text($text, $limit) { | |
if (str_word_count($text, 0) > $limit) { | |
$words = str_word_count($text, 2); | |
$pos = array_keys($words); | |
$text = substr($text, 0, $pos[$limit]) . '...'; | |
} | |
return $text; | |
} |
This file contains hidden or 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
// http://www.wpbeginner.com/wp-tutorials/how-to-limit-search-results-for-specific-post-types-in-wordpress/ | |
function searchfilter($query) { | |
if ($query->is_search && !is_admin() ) { | |
$query->set('post_type',array('recipes')); | |
$query->set('posts_per_page',10); | |
} | |
return $query; |
This file contains hidden or 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 get_all_categories($taxonomy) { | |
$terms = get_terms( | |
array( | |
'taxonomy' => $taxonomy, | |
'hide_empty' => false, | |
) | |
); | |
if ( $terms && ! is_wp_error( $terms ) ) : |
This file contains hidden or 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('above_footer') ) { | |
$post_id = get_the_id(); | |
} else { | |
$post_id = 41; | |
} | |
$vcM = Vc_Manager::getInstance(); | |
$vc = $vcM->vc(); |
This file contains hidden or 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
http://wp-snppts.com/archive |