How to get custom or filtered endpoints in WordPress API?

Here is an example of how to use Javascript to read posts from the WordPress API. //Pegasus = Theme name $.getJSON(‘https://visionquestdevelopment.com/wp-json/wp/v2/posts’, function(data){ //foreach post for (i = 0; i < data.length; i++) { //console.log(data[i]); var output=””; var dateT; var dateArr = []; //skip one of the posts with 404s on images if( ‘1555’== data[i].id ) … Read more

Custom User Notice Upon Login

You could add code via the wp_login() hook; see how it works here: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login . The hook would be placed in your Child Theme’s function.php file (always use a Child Theme; you never want to modify theme code, as your code changes will be overwritten on a theme update).

Can’t get or display post thumbnail in wordpress

Please notice, has_post_thumbnail() does not only check to see if the post has a featured image, but also checks if there is an image in the post itself. There is a quote from WordPress Code Reference: It’s worth noting that has_post_thumbnail() does not just check for the Featured Image as the Codex User Contributed Note … Read more

How to add subdomain to htaccess

In your plugin: <?php register_activation_hook(WP_PLUGIN_DIR.’/your/plugin/path/plugin.php’, ‘wpse_set_subdomain’); function wpse_set_subdomain() { $siteurl = site_url(); $subdomain = substr($siteurl, 8, 3); // may need to adjust which substring to grab update_option(‘wpse_subdomain’, $subdomain); } ?> Then wherever you have conditional content: <?php $subdomain = get_option(‘wpse_subdomain’); if($subdomain == ‘www’) { // www code } else { // other code } ?> … Read more

Help with customising love it plugin (use within foreach)

A couple of problems- setup_postdata doesn’t work with any variable other than $post, so that line is doing nothing. This is explained on the Codex page for setup_postdata. get_the_ID doesn’t accept any arguments, but it doesn’t matter, you’ve already got the ID in $event->ID, just change all instances of get_the_ID($event->ID) to $event->ID.