Connecting a wordpress site to an AngularJS APP
Use the WP API to pull in content, posts, pages. I don’t think that menus are in the API and I found that I wanted my own menu structure for my WP/angular apps anyway.
Use the WP API to pull in content, posts, pages. I don’t think that menus are in the API and I found that I wanted my own menu structure for my WP/angular apps anyway.
If you’re using SSL (HTTPS URL) you don’t need to use oauth1.0 with oauth signature and everything. All you need to do is pass in the consumer_key and consumer_secret in the url https://localhost/wpShop/wc-api/v2/products?consumer_key=ck_1111111111122123&consumer_secret=cs_232332322233232 That’s it! However, if your URL is NOT SSL, then you have to go to the trouble of creating an HMAC-SHA1 keys … Read more
I am not entirely sure what your setup is, but you could probably use jQuery to add a on(‘click’) to the iframe element. perhaps: $(iframe).on(‘click’,function(){ window.location = “http://www.yoururl.com”; })
wp_enqueue_scripts doesn’t work for template pages
I got it solved…. function filter_image_send_to_editor($html, $id, $caption, $title, $align, $url, $size, $alt) { $animatedGif = (bool) get_post_meta($id, ‘animated_gif’, true); if($animatedGif){ $gifCoverImgUrl = get_post_meta( $id, ‘animated_gif_cover_url’, true ); // build my GIF player if(isset($gifCoverImgUrl) && $gifCoverImgUrl != ”){ $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $src = $xpath->evaluate(“string(//img/@src)”); $html=”<img class=”gifplayer” src=””.$gifCoverImgUrl.'” data-gif=”‘.$src.'” />’; … Read more
Okay sorry for wasting everyones time. there was a random jQuery() in the file that was causing the issue. Just to clarify my other question though, should I include the js scripts in a particular way? Thanks
The original code is using prevAll on the minus button, but the target input appears later in the DOM. PrevAll worked fine for the plus button though, since the targeted input comes before the plus button. The modified code below is tested and working: jQuery(document).ready(function ($) { // Containing selector var parentSelector = $(‘.quantity’); // … Read more
load-scripts.php loads incorrect file names
So the problem with injection is going to be that the javascript is only going to run after everything has loaded, which means that the, and it needs to make the all the image requests to the server again. Unfortunately, you probably can’t make the requests any earlier than they’re already being made, since they’re … Read more
In your theme’s functions.php: function my_theme_slug_enqueue_script(){ if(is_page_template(‘path/to/template/relative/to/theme/directory/root/template_file.php’)){ wp_enqueue_script( ‘some_unique_string_name’, ‘path/to/js/file/script.js’, array(), false, true ); } } add_action( ‘wp_enqueue_scripts’, ‘my_theme_slug_enqueue_script’ ); Change the values in my snippet to your requirements (and you need to call wp_enqueue_script() twice, once for each of your JS files). The third parameter allows you to tell WordPress what other scripts this … Read more