Get not the full path

You might want to use the media_media_sideload_image() function. This function will fetch an image from a URL and upload it for you. Take a look into this custom function: function upload_image_from_url($image_url, $post_id, $title) { $img_name = basename ($image_url); global $wpdb; $query = “SELECT post_id FROM {$wpdb->postmeta} WHERE meta_value=”$img_name””; $id = $wpdb->get_var($query); if (is_numeric($id)) { return … Read more

plugin_dir_url(__FILE__) searches parent theme in ACF extension

I’m a total dummy. Looked through the field file and found this: function input_admin_enqueue_scripts() { // Note: This function can be removed if not used // register acf scripts wp_register_script(‘acf-input-column’, $this->settings[‘dir’] . ‘js/input.js’, array(‘acf-input’), $this->settings[‘version’]); wp_register_style(‘acf-input-column’, $this->settings[‘dir’] . ‘css/input.css’, array(‘acf-input’), $this->settings[‘version’]); // scripts wp_enqueue_script(array( ‘acf-input-column’, )); // styles wp_enqueue_style(array( ‘acf-input-column’, )); } $settings->[‘dir’] was set … Read more

AddThis Plugin adding html comments in P tags

You put this function there: $(“#main”).each(function() { var text = $(this).text(); text = text.replace(“<p><!– AddThis Sharing Buttons above –></p>”, “”); $(this).text(text); }); Did it work? If not, why do you want to do that? You can go to the main plugin and replace this text..

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