Enqueueing a script and a style sheet not working

In the context of parent – child themes, be aware that: The get_template_directory_uri() will give you the parent theme directory uri: https://codex.wordpress.org/Function_Reference/get_template_directory_uri. The get_stylesheet_directory_uri() will give you the child theme directory uri: https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri You are enqueueing parent-style with get_stylesheet_directory_uri(), which will give you the child theme directory uri. You are enqueueing child-css and child-js using … Read more

Enqueue js script to footer

Have you looked at wp_enqueue_script in the WordPress codex? You’ll most likely need to add this to functions.php in your theme’s directory. Also, where are you enqueuing the startapp_js dependency? function prefix_enqueue_scripts() { wp_enqueue_script( ‘startapp-js’, get_template_directory_uri() . ‘/scripts/Startapp.js’, array(), ”, true ); wp_enqueue_script( ‘app-js’, get_template_directory_uri() . ‘/scripts/App.js’, array( ‘startapp-js’ ), ”, true ); } add_action( … Read more

I need to get an array from the wordpress database

Is this what you are asking for? Use it after the code you posted to create posts in loop and use thier ids to update meta fields. Replace “post_type” with your custom post type. foreach ($markers as $marker){ $post_id = wp_insert_post(array( “post_title” => “something”, “post_type” => “your-type”, “post_status” => “publish”, //by default they are drafts … Read more

Adding custom directory and PHP files in wordpress

The github repo seems to be a custom code that you need drop into your theme directory, update your config file using your twitter credentials and try putting this code inside the body in any of your intended theme files that you will use(eg, index.php) <h1>Tweets of a certain user</h1> <div class=”stream”> <h2><span>Twitter</span></h2> <ul class=”timeline”></ul> … Read more

WP functions in .js

To access server-side functions you’ll need to trigger a server event from JS using AJAX, JSON API, XML/RPC, custom endpoints, or even template_redirect hooks. Just be sure to liberally sprinkle nonces when performing major functions. The simple and proven technique is the AJAX call. Setup a couple handlers when AJAX receives an action while the … Read more

Push metadata in array

You need to loop through your posts, and retrieve the metadata for each post. Add them to your array, and encode them to JSON. $posts = $query->get_posts(); foreach( $posts as &$thispost ) { // reference the current item $thispost->meta = get_post_meta( $thispost->ID ); } Now you got a WP_Post-Object, with all the post meta available … Read more

Creating a Multi-Level Associative Object Using AJAX

If you want to pass a complex value, your best path is probably to jsonify it. Something like $.post( MyAjax.ajaxurl, { action: ‘my_action’, someValue: JSON.stringify({ one: ‘Some Value One’, two: ‘Some Value Two’, three: ‘Some Value Three’, four: ‘Some Value Four’, }) } ); and then on the server side you decode the value with … Read more