Hide BBPress create topic on one page

This took as surprisingly long time but I managed to figure it out: fieldset.bbp-form { display: none; } .page-id-170 * fieldset.bbp-form { display: block !important; } I know this hides all and only shows on page id 170, and this is the opposite of what I asked but it suits my needs. An answer more … Read more

Return true if parent page id matches

You can get all ancestors with get_post_ancestors. The root ancestor is the last element of the returned array. Here is the function that checks a target page id against the root ancestor of current page: function check_page_parent( $target_page_id ) { $ancestors = get_post_ancestors( get_the_ID() ); if ( $ancestors ) { $top_most_parent_index = count( $ancestors ) … Read more

How to get an array of pages ID by some page’s slug and all its children pages in get_posts() function?

You can use get_page_by_path() to get a Page’s WP_Post object using its slug (ie, its path), and then use that object to then get the array of child page IDs using get_children(). // First we’ll create the list of posts (pages) to exclude. $exclude = array(); $parent_page_obj = get_page_by_path( ‘abc’ ); if ( ! empty( … Read more

How do I find out which (page) template file my custom child post is looking for?

If think you were using the wrong filter, please try using ‘single_template’. I assume you have created a plugin to create your custom post type. In the plugin folder you have a “templates” folder where you put the single page template called “palaver_single.php”. function palaver_single_mapping($single) { global $post; if ( $post->post_type == ‘palaver’ ) { … Read more

Get first level children of a page ID

As per the get_pages() documentation: ‘child_of’ (int) Page ID to return child and grandchild pages of. ‘parent’ (int) Page ID to return direct children of. Default -1, or no restriction. So to get immediate children of a specific page, you would use the parent arg and not child_of. $pages = get_pages( array( ‘parent’ => $pageID, … Read more

Show child by slug, while knowing parent ID

this is how i solved my problem: <?php $pageid = $post->ID; $pageslug = $post->post_name; $pos = $post->post_parent; $posname = get_post_field( ‘post_name’, $pos );; $arg1 = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => 1, ‘pagename’ => $posname.”https://wordpress.stackexchange.com/”.$pageslug.’/infraestructura’, ); $child = new WP_Query( $arg1 ); ?> <div class=”wrapp”> <?php if ($child->have_posts()) :?> <?php while ($child->have_posts()) : $child->the_post(); ?> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)