How can I detemine the parameters needed by the_widget()?
If you don’t need to change any of the settings for the widget, you may be able to use the Duplicate Widget widget.
If you don’t need to change any of the settings for the widget, you may be able to use the Duplicate Widget widget.
example: <?php //get top level page ID; $top = ( $post->post_parent ) ? array_pop(get_post_ancestors($post->ID)) : $post->ID; echo ‘<ul>’; wp_list_pages(‘title_li=&child_of=”.$top.”&depth=1’); echo ‘</ul>’; ?>
Post ID is not an argument in the_title() (see Codex article). Accepted arguments are: the_title( $before, $after, $echo ); Take a look at the source code. The function the_title() calls get_the_title() with no arguments, whereas get_the_title() takes a Post ID as its only argument. If you want the title of a post/page other than the … Read more
I see at least two potential issues: You have if ( have_posts() ) : twice. Here: <?php if ( have_posts() ) : ?> <h1 class=”page-title”><?php printf( __( ‘Search Results for: %s’, ‘nothing’ ), ” . get_search_query() . ” ); ?></h1> And here: <ul id=”post-list”> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> The get_template_part() … Read more
Check if each category has a parent: foreach( ( get_the_category() ) as $category ) { if( $category->category_parent != 0 ): echo $category->cat_name . ‘ is a child category ‘; else: echo $category->cat_name . ‘ is a parent category ‘; endif; }
strange thing – try is_home() . what does that returns ?
bp_current_component() does not necessarily return a boolean – it returns false if not in a BP component, but will return the name of the component otherwise, as a string. Internally, BP uses the function bp_is_blog_page() to do what you’re asking – if it returns true, it’s not a BP page.
We were able to get custom category and tag base names using: get_option(‘category_base’, ‘Categories’) get_option(‘tag_base’, ‘Tags’) We wrapped these functions in ucwords() in order to capitalize the base name and replaced “_” with “”: ucwords(str_replace(‘_’,’ ‘,get_option(‘category_base’, ‘Categories’)) ucwords(str_replace(‘_’,’ ‘,get_option(‘tag_base’, ‘Tags’)) Finally we wrapped all this with the code for localization and added the single cat/tag … Read more
Page templates are special case and since WP 3.4 can be put in subfolder natively. Other than that WP mostly expects flat file structure for templates. While template hierarchy is easily adjusted (see dynamic filter in get_query_template(), pretty much only thing needed)… From personal experience – overly extensive and nested directory structure for templates makes … Read more
That’s because you don’t have the $terms[0] element. Use following code to get the first key of $terms array: <?php // Set the pointer to the first element // you don’t need this if there is the only array element reset($terms); // get the key of the current position $selected_id = key($terms); You MUST enable … Read more