how to import contacts from php to wordpress

By default, when adding a new user using either wp_create_user() (https://developer.wordpress.org/reference/functions/wp_create_user/) or wp_insert_user() (https://developer.wordpress.org/reference/functions/wp_insert_user/) the password is passed in as a plain-text string, and the WP functions will encrypt into the wp_users table. There are some plugins out there that will allow import from a CSV (example: https://wordpress.org/plugins/import-users-from-csv/) If you are looking at writing your … Read more

how to convert wordpress query to pdo query

I just found my answer “SELECT post_title ,post_date, display_name ,wp_users.ID, wp_users.display_name as user_nicename, COUNT(*) as count FROM wp_posts, wp_users, wp_term_relationships WHERE wp_posts.post_type=”post” AND wp_posts.post_status=”publish” AND wp_posts.post_author = wp_users.ID AND wp_posts.ID = wp_term_relationships.object_id AND wp_term_relationships.term_taxonomy_id = ’10’ GROUP BY post_author ORDER BY count DESC LIMIT 5 ;”

how to add display_name

Is this the same situation you are also asking in how to add display_name from the users table to this query – yes? You can see my answer there.

php-page with db connection

This file to access WordPress default functions has to be inside the WordPress folder. It’s the best practice to create a plugin if you want to add custom features. WordPress provide directory path and URL’s functions with which you can get the path of any specific file. Please visit the following links to understand how … Read more

Why not showing all post by default in my jquery filter

@HappyArif You just kept a line in your code that needs to be changed if there is a Category selected. $args = array( ‘orderby’ => ‘date’, ‘post_type’ => ‘course’, ‘posts_per_page’ => -1, ‘tax_query’ => $tax_query, ); This have ‘posts_per_page’ => -1 which needs to be changed to ‘posts_per_page’ => 9, ‘paged’ => $paged to make … Read more

PHP code for link with text

maybe try with php DOMDocument rather than regex. I don’t think all DOMDocument methods will work with just an html fragment and not a complete document, but for your needs it may be enough: <?php $dom= new DOMDocument(); $html=”<p>Some html with a <a href=”http://foo.com/”>link</a>. Some more text and <a href=”http://bar.com/”>another</a> link.</p>”; $dom->loadHTML( $html ); $dom->preserveWhiteSpace … Read more

Implement “No related posts for this entry” into the loop?

I still can’t see how the code and the problem is substantially different from your original topic; however, try to add your text into the typical ‘else’ location for a loop if no posts are found; change this line: <?php endwhile; endif; ?> to: <?php endwhile; else : echo ‘<h3 class=”no-related-posts”>sorry but there are no … Read more