How to show only one image in homepage

If I understand your question right, a function that truncates your text after stripping HTML is what you need. What about using wp_trim_words(): <?php while($breakingnews->have_posts()) : $breakingnews->the_post(); ?> <a href=”https://wordpress.stackexchange.com/questions/253344/<?php the_permalink(); ?>”><?php the_post_thumbnail(‘post-image’); ?></a> <div class=”leadnewsboxtitle”> <h2><a href=”https://wordpress.stackexchange.com/questions/253344/<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <p><?php echo wp_trim_words( get_the_content(), 60, ‘…’ ); ?></p> </div> <?php endwhile; ?> General … Read more

Getting the Select and Crop Functionality Using Custom Fields

I have a partial solution where I can add a image crop uploader to the theme customization page. I have yet to figure out how to attach it to acf. function add_my_media_controls($wp_customize) { $wp_customize->add_section( ‘theme_banner_image’, array( ‘title’ => __( ‘Banner Image’, ‘theme_banner_image’ ), ‘priority’ => 35, ) ); $wp_customize->add_setting(‘banner_image’, array( ‘type’ => ‘theme_mod’, ‘capability’ => … Read more

Getting the closest named image size from an array of dimensions

Turns out, image_get_intermediate_size() was easy enough to adapt to my needs. Instead of using wp_get_attachment_metadata to get an existing image’s available sizes I use my own function to get all available image sizes (essentially the same as the function proposed here). I then simply return the name rather than the array of meta data. It … Read more

Issues Adding a jQuery Image Slider

Two things to try: Move the enqueue for slick.js above the enqueue for your custom script. Declare Slick as a dependency for your custom script. Change the third parameter to include slickjs: wp_enqueue_script(‘customjs’, get_template_directory_uri() . ‘/js/victoria_theme.js’, array( ‘slickjs’ ), ‘4.7.2’, true);

Disable links to images only if link is an image

I am not a professional when it comes to regular expressions but this should be able to catch all linked images which the href attribute links to an image file ((png|jpg|gif|jpeg|bmp) feel free to add/remove extensions): add_filter(‘the_content’, function($c){ return preg_replace_callback(“#<\s*?a\b[^>]*>(.*?)</a\b[^>]*>#s”, function($m){ $tpl = $m[0]; $cnt = isset($m[1]) ? $m[1] : null; if ( preg_match(‘/<a(.*?)?href=[\'”]?.+\.(png|jpg|gif|jpeg|bmp)[\'”]?(.*?)?><\/a>/i’, str_replace($cnt, … Read more

Put image onto header

First of all gain access to website files using FTP account, if you are not familiar with it, just google “FTP” and “FileZilla” and read some lines. Then go to /wp-content/themes/Twenty Seventeen/header.php insert the image html where you wish it to be

WordPress Shortcode to display featured images only

The plugin you’re using Display Posts Shortcode does include a parameter to disable post titles: include_title=”false” So your shortcode would look like this: [display-posts category=”OSH” include_title=”false” image_size=”standard”] Hope that helps.