Writing a plugin http://codex.wordpress.org/Writing_a_Plugin
The plugin API http://codex.wordpress.org/Plugin_API
Post Meta fields http://codex.wordpress.org/Function_Reference/post_meta_Function_Examples
Taxonomies
| <?php | |
| $post_type = 'post'; | |
| // Get all the taxonomies for this post type | |
| $taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) ); | |
| foreach( $taxonomies as $taxonomy ){ | |
| // Gets every "category" (term) in this taxonomy to get the respective posts | |
| $terms = get_terms( $taxonomy ); | |
| foreach( $terms as $term ){ | |
| echo $term->name; | |
| } |
| <?php | |
| session_start(); | |
| add_filter( 'posts_orderby', 'randomise_with_pagination' ); | |
| function randomise_with_pagination( $orderby ) { | |
| if( is_front_page() ) { | |
| // Reset seed on load of initial archive page |
| /** | |
| * Change class when element is in view | |
| */ | |
| var elementTop = $(".container").offset().top; | |
| $(window).on("scroll", function updateClassWhenInView() { | |
| if ($(window).scrollTop() > elementTop - window.innerHeight * 0.9) { | |
| $(window).off("scroll", updateClassWhenInView); | |
| $(".element").removeClass("is-hidden").addClass("is-visible"); | |
| } |
| <?php | |
| namespace WPMemeShortcode; | |
| /** | |
| * The WordPress Meme Shortcode admin page. | |
| * | |
| * @author Carl Alexander | |
| */ | |
| class AdminPage |
| <?php | |
| // check parent repeater | |
| if( have_rows('parent_navigation_items', 'options') ): | |
| echo '<ul class="nav primary-header-nav">'; | |
| // loop parent items | |
| while ( have_rows('parent_navigation_items', 'options') ) : the_row(); | |
| echo '<li>'; |
| <?php | |
| add_action('gform_after_submission', 'gfToAcfListToRepeater', 10, 2); | |
| function gfToAcfListToRepeater($entry, $form) | |
| { | |
| foreach ($form['fields'] as $field) { | |
| if (!($field['type'] == 'post_custom_field' && $field['inputType'] == 'list' && $field['enableColumns'] == true)) { | |
| continue; | |
| } | |
| $id = $field['id']; |
Writing a plugin http://codex.wordpress.org/Writing_a_Plugin
The plugin API http://codex.wordpress.org/Plugin_API
Post Meta fields http://codex.wordpress.org/Function_Reference/post_meta_Function_Examples
Taxonomies
| // populate acf field (sample_field) with post types (sample_post_type) | |
| function acf_load_sample_field( $field ) { | |
| $field['choices'] = get_post_type_values( 'sample_post_type' ); | |
| return $field; | |
| } | |
| add_filter( 'acf/load_field/name=sample_field', 'acf_load_sample_field' ); | |
| function get_post_type_values( $post_type ) { | |
| $values = array(); |
| <?php | |
| /* | |
| * | |
| * Uses: get_tagged_post() or get_tagged_post( AN ARRAY OF BLOG IDs ) | |
| * | |
| */ | |
| function get_tagged_post($blogs = array(), $tag) { | |
| if( count( $blogs ) < 1 ){ | |
| $blog_list = wp_get_sites(); |