PHP Use Declared array Variable inside already Declared Array

This is more a generic PHP question than anything to do with WordPress, but I’d suggest setting the value in the constructor: class test { public $basicCols; public $optList = array( ‘one’ => ‘One’, ‘two’ => ‘Two’ ); function __construct() { $this->basicCols = array( array( ‘title’ => ‘KEY’, ‘field’ => ‘slug’, ‘options’ => $this->optList ), … Read more

How do I create a sticky sidebar?

I did not really understand your question, but try this (using bootstrap v3): <div class=”clearfix”> <?php $a = 0; $classes = array(‘post-1′,’post-2′,’post-3’); query_posts(‘category_name=Menucard’); ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class=”<?php echo $classes[$a]; ?> col-4 post move pull-left”> <?php //echo post here the_content(); ?> </div> <!– close … Read more

How to mark every 3rd post

My approach. No extra function, no filter. 🙂 <?php $GLOBALS[‘wpdb’]->current_post = 0; ?> <div <?php post_class( 0 === ++$GLOBALS[‘wpdb’]->current_post % 3 ? ‘third’ : ” ); ?>> Alternative: <div <?php post_class( 0 === ++$GLOBALS[‘wpdb’]->wpse_post_counter % 3 ? ‘third’ : ” ); ?>>

Help with output of post classes using apply_filters

Solved it with generous help using join()… function start_el(&$output, $page, $depth = 0, $args = array(), $id = 0) { if ( $depth ) $indent = str_repeat(“\t”, $depth); else $indent=””; extract($args, EXTR_SKIP); $output .= $indent . ‘<li id=”item_’.$page->ID.'” class=”‘.join( ” “, get_post_class( “”, $page->ID )).'”><span>’.apply_filters( ‘the_title’, $page->post_title, $page->ID ).'</span>’; }

WordPress Tags in class

Where are you getting these tags from? Typically, to get a list of tags attached to a post, you’d do: $some_tags = wp_get_post_tags( $post_id); and then itterate through as such: foreach($some_tags as $tag) { do stuff }

Post Class for Custom Taxonomy Error

As a quick fix I looped through each custom taxonomy type. if ( ! function_exists(‘custom_taxonomy_class’) ) { function custom_taxonomy_class($classes, $class, $ID) { $args = array( ‘public’ => true, ‘_builtin’ => false ); $output=”names”; // or objects $operator=”and”; // ‘and’ or ‘or’ $taxonomies = get_taxonomies( $args, $output, $operator ); foreach ($taxonomies as $key) { $terms = … Read more