How to print array of specific item

Not really a WordPress question, but I’ll bite. That data is JSON. To manipulate it with PHP you need to decode it with json_decode(). Then you can treat it as a PHP object. So to access the values you’d mention, and assuming the JSON is in a variable named $json: $object = json_decode( $json ); … Read more

How to store queried custom data and use it in multiple pages?

Though it’s not clear exactly what do you want. But, you can do this by two ways. Make a Function like function wpse_1001(){ $contact = new WP_Query(array( ‘post_type’ => ‘contact’ // ‘post_status’ => ‘publish’ )); while($contact -> have_posts()){ $contact -> the_post(); $watsapp = get_field(‘watsapp_no’); $mobile = get_field(‘mobile_no’); $telephone = get_field(‘telephone_no’); $address = get_field(‘address’); } wp_reset_query(); … Read more

How to replace text in hompage only

the_content(Read more …’) echoes the stuff straight out so you can’t modify it with str_replace after the fact. If you wanna use str_replace you need to do something along the lines of $content = get_the_content( ‘Read more …’ ); $content = apply_filters( ‘the_content’, $content ); $content = str_replace( ‘]]>’, ‘]]>’, $content ); $content = str_replace( … Read more

JavaScript errors

Try & paste this below code your active theme functions.php file add_action( ‘wp_enqueue_scripts’, ‘load_jquery_fix’, 100 ); function load_jquery_fix() { if ( ! is_admin() ) { wp_deregister_script( ‘jquery’ ); wp_register_script( ‘jquery’, ( “//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js” ), false, ‘1.11.3’ ); wp_enqueue_script( ‘jquery’ ); } }

How to display only sticky posts on my automatically generated front page?

WordPress saves sticky posts inside the option named sticky_posts. You can retrieve them via get_option(‘sticky_posts’). With that knowledge it is possible to change the query to only query for sticky posts, you usually do so via the pre_get_posts hook. add_action(‘pre_get_posts’, ‘WPSE_home_only_stickies’); function WPSE_home_only_stickies($query) { // only run for homepage & main query if ($query->is_home() && … Read more

Static var overwritten with WP AJAX action, works fine without AJAX

Instead of a static class property, you could use a PHP session: class progress { public function __construct() { session_start(); } public function getTotal() { return $_SESSION[ ‘total’ ]; } public static function setTotal() { $_SESSION[ ‘total’ ] = ‘123’; } } If you’re doing more complex stuff, a session wrapper like Symfony’s might be … Read more

Domain Pointing to www.domain.com:8888

Moving a site is more than moving the database. And it is more than updating the wp-options table’s URLs (although that is important). You also have to change any references to the old URL in the database. I use a plugin called “Better Search and Replace” to update the URLs in the database. (There are … Read more