Display post on main page with thumbnail

What you need is a featured post plugin, you can either display that POST in the widget area or below the SEPARATOR line by using a template function. You can find many plugins to do this job at WordPress Plugin Repository. Link Here are 2 plugins Display Features News on Front Page Featured Post Content … Read more

Frontend Feature image upload not work

Use the following code. <?php // Upload image to wordpress media and save image url to custom field. if(isset($_FILES[‘images’])) { // These files need to be included as dependencies when on the front end. require_once( ABSPATH . ‘wp-admin/includes/image.php’ ); require_once( ABSPATH . ‘wp-admin/includes/file.php’ ); require_once( ABSPATH . ‘wp-admin/includes/media.php’ ); require_once( ABSPATH . ‘wp-admin/includes/admin.php’ ); $file_return … Read more

Retrieve Header Background Image with AJAX

It was easier than i thought. After a lot of reading and trying I’ve finally got it ! This is the answer with explications if it can help someone. 1- In functions.php localize hero.js function mytheme_header_script() { // Adding custom javascript file to handle the header image. wp_enqueue_script(‘mytheme-hero’, get_theme_file_uri() . ‘/assets/js/hero.js’, array(‘jquery’), ”, true); // … Read more