Tag Info

New answers tagged

1

get_post() returns a post object. So you can try the following $post = get_post( 1571 ); setup_postdata( $post ); the_title(); the_content(); wp_reset_postdata();


0

If your certain sidebar widget area is page-specific then I think you need to load classes only to those pages. If so, use is_page() with it: if( is_page('that-page') && is_active_sidebar('your-sidebar') ) { $class = 'your-class '; } If it's true for all the inner pages other than the front-page, use: if( !is_front_page() && ...


0

If you want to know about Sidebar Generator issue then you can use this codes:- if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar(1) ) No. Also, no need to use functions_exists(). This is one of the correct methods for registering and calling a sidebar in a template file. There's 2 steps. One. This code goes in your functions ...


0

Hate to answer my own question, but I fixed it. Seems the issue was with how the pages were getting added to the menu via the WordPress admin. After removing and adding them back, the sidebars appeared just fine. So, in the event someone else has a similar problem, just delete the pages and re-add them.


0

If you take a look at register_sidebar() source it just stores data in $wp_registered_sidebars global variable. You could examine it and retrieve data from it as you need to.


0

This is more of a pure PHP than WordPress. You are implicitly creating $ranNum as local variable in function scope. $Example_Widget won't access widget instance in PHP. What you should be using is $this->ranNum, for reading and writing. That will create object's property implicitly, but you likely should declare it explicitly in your class definition ...



Top 50 recent answers are included