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
<ul> | |
<?php | |
$query = new WP_Query( array( | |
'post_type' => 'course', //post type slug | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'course_type', //taxonomy slug | |
'field' => 'slug', | |
'terms' => 'post-graduate') //term slug | |
)) ); |
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_action( 'init', 'build_taxonomies', 0 ); | |
function build_taxonomies() { | |
register_taxonomy( | |
'course_type', //taxonomy slug | |
'course', // custom post type slug | |
array( | |
'hierarchical' => true, //shows as category, set false to show as tags | |
'label' => 'Course Type', //taxonomy label | |
'query_var' => true, | |
'rewrite' => true |
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
// Create taxonomy term with same name as Post Title | |
function create_course_name($post_ID) { | |
global $wpdb; | |
$cat = get_the_title($post_ID); // grabs the post title | |
wp_set_object_terms($post_ID, $cat, 'course_name'); //course_name is the taxonomy slug | |
} | |
add_action('save_post', 'create_course_name'); // This creates the term on Save |
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 | |
// Assign a taxonomy term with the same name as the Course assigned to the Tutor | |
function create_tutors_course($post_ID) { | |
global $wpdb; | |
$postObjectID = get_field('tutor_course', false, false); //grab the assigned Course's post ID | |
if($postObjectID) { | |
$catName = get_the_title($postObjectID); //grab the title of the Course | |
wp_set_object_terms($post_ID, $catName, 'course_name'); //course_name is the taxonomy slug |
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 CUSTOM ITEM TO MENU (ACF) | |
\*------------------------------------*/ | |
add_filter('wp_nav_menu_items','custom_menu_item', 10, 2); | |
function custom_menu_item( $items, $args ) { | |
if( $args->menu->slug == 'menu-1') { | |
$content = get_field('brochure-link', 'option'); | |
$items .= '<li>' . $content . '</li>'; |
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 | |
$image = get_field('image_field_slug'); // the image field slug - set the field Return Value to 'Array' | |
$size = 'large'; // the image size | |
$thumb = $image['sizes'][ $size ]; //get the URL | |
echo '<div class="div-30" style="background:url(' . $thumb . ')"></div>'; | |
?> |
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
/*------------------------------------*\ | |
REPLACE WP GALLERY WITH THE_GRID PLUGIN | |
\*------------------------------------*/ | |
$GLOBALS['the_grid_gallery'] = 'Gallery'; // add your grid name here | |
// remove the native gallery shortcode | |
remove_shortcode('gallery'); | |
// redeclare the gallery shortcode | |
add_shortcode('gallery', 'the_grid_gallery_shortcode'); | |
function the_grid_gallery_shortcode($ids) { |
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 | |
/** | |
* Plugin Name: Plugin Name | |
* Plugin URI: http://solidpixel.com | |
* Description: Description | |
* Version: 1.0.0 | |
* Author: Pelly | |
* Author URI: http://solidpixel.com | |
* License: GPL2 | |
*/ |
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
jQuery(function () { | |
// Define your callback | |
var myCallback = function () { | |
// action to execute after SVG animation is complete - optional | |
}; | |
// Get your HTMLCollection of SVG to animate | |
var myElements = jQuery(".animate svg"); |
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 my_acf_load_value( $value, $post_id, $field ) { $value = get_the_title(); return $value; } add_filter('acf/load_value/name=FIELD_NAME', 'my_acf_load_value', 10, 3); |