problem loading stylesheets to wp_head dynamically
While your code is a bit messy, I think the one thing that is breaking it is the wp_enqueue_style you’ve got there. The second parameter “10” just shouldn’t be there.
While your code is a bit messy, I think the one thing that is breaking it is the wp_enqueue_style you’ve got there. The second parameter “10” just shouldn’t be there.
It’s not a global variable; in fact it’s not a variable at all. It’s just placeholder within the sprintf() function. Take a look at the sprintf PHP function documentation. In the example you cite, the author is using the ‘argument swapping’ placeholder syntax: %n$t where %n is the placeholder number that corresponds to the argument … Read more
In WordPress you need to start the session with if ( !session_id() ) { session_start(); } in order to use session variables. You can enter this code into wp-config See http://www.frank-verhoeven.com/using-session-in-wordpress
You’d have to declare it first above those includes and globalize it within header or footer before getting or setting the value. however- in the specific context you’re speaking of- getting a custom field value, it’s only retrieved from the database on the first call, then cached, so subsequent calls won’t hit the database again.
First off, these aren’t CGI variables, they’re query string arguments. WordPress, by default, will remove any query arguments that it doesn’t recognize. So you need to register them with WordPress and then pull them back out of the query. First, add your new query variable: function wpa_48528_vars( $vars ) { $vars[] = ‘filter’; return $vars; … Read more
The problem has nothing to do with the rewrite rules (though I would suggest using add_rewrite_rule() rather than the more low level approach of altering the rewrite array directly. The same for flush_rewrite_rules(). Also, although as you have it the rules are only flushed once – it would be better to do it on the … Read more
get_category_by_slug() returns a category object or FALSE: $cat1 = get_category_by_slug( ‘cata’ ); print ‘<pre>’ . htmlspecialchars( print_r( $cat1, TRUE ) ) . ‘</pre>’; Result: stdClass Object ( [term_id] => 3 [name] => Cat A [slug] => cata [term_group] => 0 [term_taxonomy_id] => 3 [taxonomy] => category category__not_in and id values from variable => [parent] => … Read more
This is more of a basic PHP question, but still it’s somewhat important. Inside your foreach loop, $category is a locally-defined variable. That’s to say, it only exists inside the foreach loop. So if you have foreach ( $categories as $category ) { // You can use $category all you want in here } // … Read more
add a simple counter and conditional check: $pages = get_pages(‘child_of=10’); $counter = 1; if ($pages) { echo ‘<ul class=”projectthumbs”>’; foreach ($pages as $page) { if ($counter == 3){ $class=” class=”YOUR_CLASS””; $counter = 1 }else{ $class=””; $counter = $counter +1; } echo ‘<li’.$class.’><a href=”‘.get_permalink($page->ID).'”>’; echo get_the_post_thumbnail($page->ID); echo ‘<span class=”projectthumbtitle”>’; echo get_the_title($page->ID); echo ‘</span>’; echo ‘</a></li>’; } … Read more
$(“#top .menu ul li”).each(function(i, el) { $(this).children(‘a’).prepend(“<span>” + (i+1) + “</span>”); }); or much better $(“#top2 .menu ul li”).each(function() { var $this = $(this); $this.children(‘a’).prepend(“<span>” + ($this.index()+1) + “</span>”); }); check this out for the difference… http://jsfiddle.net/reigel/aAYCt/