How to echo every parent page title?

Check Post & Page Parameters or get_page_children(). <?php global $post; $args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ‘post_parent’ => $post->ID, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order’ ); $parent = new WP_Query( $args ); if ( $parent->have_posts() ) : ?> <?php while ( $parent->have_posts() ) : $parent->the_post(); ?> <div id=”parent-<?php the_ID(); ?>” class=”parent-page”> <h1><a … Read more

How do I create a secondary version of the_content

You’re overcomplicating things. If you want the_content() to behave as it usually does, then don’t change it via filter or similar. Just create your new custom function, eg like so (could be placed in your functions.php or if you’re in a plugin somewhere there) function replaced_content() { $content = get_the_content(); // $content = str_replace … … Read more

proc_open() fires twice

To complete this … I initially used PHP code snippets (Insert PHP) plugin (version 2.0.6 – latest). The php page was in fact only called once, but executed twice. I didn’t have any explanation for all this described above (same temp filename, but code called twice, …). After I changed the PHP code WordPress integration … Read more

Disable if there are no children – Woocommerce

Try below code <?php $terms = get_the_terms($post->ID, ‘product_cat’); foreach ($terms as $term) { $category_name = $term->name; $parent_category_id = $term->term_id; $categories = get_categories(array(‘parent’ => $category_id)); $children = get_terms(‘product_cat’, array( ‘parent’ => $parent_category_id, ‘hide_empty’ => true )); if (!empty($children)) { echo ‘ <div class=”list-group products box”> <h4>Product Range</h4>’; foreach ($children as $subcat) { ?> <a href=”https://wordpress.stackexchange.com/questions/317473/<?php echo … Read more

Get user custom field value on function.php

EDIT I think the solution given by @dboris may work. Alternatively you could try to hook your email sending after the user registration like this global $uID; //to keep the value to reuse it later, null at this step function mailInscriptionSecteurRhone() { global $uID; $user_ID = $uID; $headers = array(‘Content-Type: text/html; charset=UTF-8’); $candidat = get_userdata( … Read more

WordPress produces identical hash all the time

The point of hashing a password when storing it in the DB is that it will not be disclosed if anyone got a dump of the DB. There has to be a 1:1 relationship between the password and the hash here as you need to be able to compute the hash of a given password … Read more

PHP Strict Standards: Only variables should be assigned by reference

The issue is caused by the arguments for separate_comments being passed by-reference. Source: function separate_comments(&$comments). This means passing a function as an argument is restricted. To resolve the issue you need to assign the get_comments function results to a variable. $comments = get_comments(‘status=approve&post_id=’ . $id); $comments_by_type = separate_comments($comments); return count($comments_by_type[‘comment’]);