Articles of parse

How to use WordPress (PHP) functions in AngularJS partials files?

I am using AngularJS to load a list of my WordPress posts, however I can not get any of my PHP functions to work with my partials file. I’ve tried using something such as search.php instead of search.html but when doing so I get errors such as fatal error get_post_meta is undefined. Now I know […]

Get closest page ID from URL

Lets say on my WordPress website I navigate to: www.example.com/media-centre/news/17/an-example-news-post In this case I am looking at a post in a CPT called News. What I want to do is get the page ID thats closest to that URL. I know the closest page ID can be found at: www.example.com/media-centre/news/ So how do I loop […]

Check what is at URI (post, archive, etc…)

Is there a way or function where you can pass in a custom uri like uri-part/uri-part2 and we can check what is under this address? I want to check if a uri hosts a post, page, archive, category, tag, other taxonomy, custom post type archive or custom?

Correct regex for wp_embed_register_handler

THE GOAL I’m trying to parse a url and convert it to an embedded video player in my post’s content but I think my regEx is off or I’m not creating a provider correctly. THE CODE Here is what I have setup now. wp_embed_register_handler(‘brightcove’, ‘/(players.brightcove.net/)([^/]+)/([^/]+)/index\.html\?videoId=([\d]+)/g’, ‘wp_embed_handler_brightcove’); function wp_embed_handler_brightcove($matches, $attr, $url, $rawattr) { // var_dump($matches, $attr, […]