How to list all the posts in a personalized page? WordPress

There is a pretty simple way to query outside the loop using get_posts. Setting post_status => ‘any’ could net you all. The code below queries posts, pages and attachments. The loops through and outputs them all to an unordered list. $pages = get_posts( array( ‘post_type’ => ‘page’, ‘post_status’ => ‘any’, ‘numberposts’ => -1, )); $posts … Read more

Jquery autosave text area after typing

Am not sure what is your ID. Let as assume the ID as example Here is the code jQuery(function($) { $(‘#example’).on(‘keyup’, function() { if(autosave_timer) { clearTimeout(autosave_timer); } autosave_timer = setTimeout(save_by_ajax, 3000); // after 3 second of keyup save_by_ajax function will execute }); function save_by_ajax(){ var mid=$(this).attr(‘data’); var tid=’#’+mid; $(tid).jqte({“status” : false}); var content = $(tid).html(); … Read more

How to avoid timeout waiting for output from CGI script?

WordPress uses a file called wp-cron.php as a virtual cron job, or scheduled task in order to automate things like publishing scheduled posts, checking for plugin or theme updates, sending email notifications and more. By default WordPress is setup to call wp-cron.php everytime someone visits your WordPress website when a scheduled task is present, to … Read more

Call custom posttype outside the functions.php

Step-by-step: If you put everything in your functions.php or plugin file, it should work just fine. We need a user meta field, where User can decide if they want to activate a certain CPT. add_action( ‘show_user_profile’, ‘my_user_meta_show_faq’ ); add_action( ‘edit_user_profile’, ‘my_user_meta_show_faq’ ); add_action( ‘user_new_form’, ‘my_user_meta_show_faq’ ); function my_user_meta_show_faq( $user ) { $show_faq = get_user_meta($user->ID, ‘show_faq’, … Read more

Pagination 404 on my index.php

The reasons why you should not run query_posts() are perfectly outlined in this answer. Long story short: You overwrite the default query (that happens by WP core) and replace everything that was valid for this request with data that only matches for your secondary query. The function get_query_var() relies on the global $wp_query that gets … Read more

foreach all the post

Your code has many errors:- $thumbs isn’t used anywhere. $img_url = $thumb[‘url’]; undefined variable if(is_array($thumb) && $img_url) always false because of second point. $search_data = []; should be outside of loop. Check the correct part of code $search_data = []; if($query->have_posts()): while($query->have_posts()): $query->the_post(); $img_url = get_the_post_thumbnail_url(); if(!empty($img_url)){ $search_data[] = array( ‘name’ => get_the_title(), ‘thumb’ => … Read more

display php code in header using wp_head()

As per my understanding you wish to print content from get_option below . For that please write below code to funcitons.php file: function my_facebook_tags() { return $options = get_option(“p2h_theme_options”); } And below code within your header file below to wp_head() write: <?php echo my_facebook_tags();?> Hope this will resolve the issue for you! EDITED: Try the … Read more