I'm trying to render my page structure as an ordered list (<ol>) showing the hierarchy using nested ordered lists. So it should look something like <ol> <li> About <ol> <li> Leadership <ol> <li>CEO</li> <li>COO</li> </ol> </li> </ol> </li> <li>Services</li> <li>Products</li> </ol> or About Leadership CEO COO Services Products I created a function to get 1 level of pages which I call recursively for any pages with child pages. function aiv_get_sibling_pages($cur_page = null) { $front_page_id = get_option('page_on_front'); $next_page = $cur_page ? …
Much like this question, I'm having trouble with wp_insert_post causing recursive post adding. I do, however, have implemented a page type check - the problem is the inserted post always gets added as the same type, no matter the type specified. function create_auto_post($post_ID) { if (get_post_type($post_ID) != 'manually-published') return; $post_ID = wp_insert_post( array( 'post_status' => 'publish', 'post_type' => 'automatically-published' ) ); } add_filter( 'save_post', 'create_auto_post', 1, 1); The inserted post is of type manually-published, therefore triggering a recursive insertion of …
There is probably another way but I would like to understand why this code returns null... I only have posts in october and here's the recursive function: function last_post( $month,$year ) { $args = array( 'monthnum' => $month, 'year' => $year ); $query = new WP_Query( $args ); var_dump( $month ); // int 11, int 10 if( $query->have_posts() ){ return $args; } else { last_post( $month-1, $year ); // here is the problem ? } } $args = last_post( 11, …
I'm working on some critical style revisions for a client's WordPress site that was designed by another team. The CSS seems to be a tangled mess. One of the idiosyncrasies I've found is that the theme's main stylesheet style.css, @imports another stylesheet from a subdirectory: css/default.css. Meanwhile, default.css @imports the main stylesheet at the top of its file too. I removed the @import directives and added the content of the default.css to style.css, but that breaks the layout regardless of …
I just can't find a way to make it possible to show only current parent items down to current page item in a vertical menu the "wordpress way". What I want to achieve is the following dynamic structure, if I visit Page 3.2.2.2: Page 1 Page 2 Page 3 Page 4 Page 3.1 Page 3.2 Page 3.2.1 Page 3.2.2 Page 3.2.2.1 Page 3.2.2.2 Page 3.2.2.2.1 Page 3.2.2.2.2 Page 3.2.2.3 Page 3.2.3 Page 3.3 Page 3.4 Page 3.5 So, only submenus …
I am given a WordPress multisite and need to extract information from the site. I have written a stored procedure that recursively builds a tree relationship for posts of a certain kind. Now I am wondering how to push the stored procedure to the databases of all the sites.(Since this is a multisite configuration, each site(subdomain in this case) has a separate database.) Please help me in this regard. WordPress version: 3.5.1 Multisite config type: subdomains //code needs refinement DELIMITER …
In my header I use this code: if(is_page("stores")) { // Do something } I run some code if on the page stores but what I want to do is run that code if the page is stores or any page that is a sub page of stores. Not only that, but is recursive so if we are on a sub sub sub page of stores the code still runs.