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://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 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
| 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
| 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
| <?php | |
| // this gist requires: http://candlestudio.net/woocommerce/plugins/button-variations/ | |
| // a fork of: https://gist.github.com/croosen/24a2845f91ce91a2819b | |
| // WooCommerce - Display custom attributes on shop page - the official way ;-) | |
| global $wc_ea_term_meta; | |
| // Get the attributes |
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 | |
| $local_folder = get_field('video_folder'); | |
| $path = "/var/sites/k/XXX.co.uk/public_html/Videos/top-video-folder/".$local_folder; | |
| $files = scandir($path); | |
| foreach ($files as &$value) { | |
| if ($value != "." && $value != "..") { |
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_pop_up($ID) { | |
| $rows_fss = get_field('slideshow_repeater',$ID); | |
| $output = ""; | |
| if($rows_fss) { | |
| $output .= "<div id='inline1' style='display: none;'>"; |
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-create-a-custom-wordpress-widget/ | |
| // | |
| // Select a Restaurant | |
| class eoc_widget_select_restaurant extends WP_Widget { | |
| function __construct() { | |
| parent::__construct( | |
| // Base ID of your widget | |
| 'eoc_widget_select_restaurant', |
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
| add_shortcode('shortcode_find_accommodation', 'shortcode_find_accommodation'); | |
| function shortcode_find_accommodation() { | |
| $terms = get_terms( array( | |
| 'taxonomy' => 'towns-accommodation', | |
| 'hide_empty' => false, | |
| ) ); | |
| if ( $terms && ! is_wp_error( $terms ) ) : | |