Change featured thumbnail based on screen size

My theme has the option( like any other theme I guess) to chose a predefined featured image size( thumbnail, medium ...etc). I chose the image to be thumbnail, made it 150x150 in media settings but my problem is with 480px screens. Here I want the thumbnail to be full width instead of 150px. If I add width: 100%; rule in CSS I get 150px images stretched to 480px and they look awfull. The code that outputs my featured images is …
Category: Web

Display of content does too wide for screen

On my 15.5" laptop, my website content width is displayed across-- off the screen. Maybe caused by PHP update last week. Noticed first on preview of new post, then when published. Old posts fit properly and when new post is viewed on a smaller screen laptop, the content fits the width as usual. What do I need to change to have content fit within the width of the screen?
Category: Web

What is the use of $content_width?

In the requirements of Envato I saw that they require a $content_width to be set. I searched for it on the internet but can't really understand why? I don't use it and the theme is responsive. If I only declare the $content_width and never use it, what value should I give it?
Category: Web

Mobile view: how to remove right/left margin from the specific widgets?

May I know how to remove right/left margin from the bottom two parts(Lessons and Fees,Contact) of my website on phone? It seems ok on PC but not on phone. Especially the table for prices lookes terrible. https://www.japaneselessons-kanazawa.com *I use Moesia theme. The first 4 widgets are called "Moesia FP"(guess their original widgets) and the rests are Siteorigin Editor/Form. *I have installed 4 Plugins; Athemes Toolbox, Moesia - Masonry Portfolio, Page Builder by SiteOrigin, SiteOrigin Widgets Bundle. When I inactivate Page …
Category: Web

How to change the content width using php?

I've created a custom template using php and would like to know how to modify the content width? Do I have to create a class within php and then modify the width using CSS? This is how my php template looks right now: <?php /* Template Name: NewEventTemplate */ ?> <?php /** * The template for displaying pages. * * @package Salient WordPress Theme * @version 10.5 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) …
Category: Web

Truncate title to single line & container width

Is there a way to truncate a title to the container width? I'm able to do truncate a long title to one line using the code below, but that doesn't really work for mobile. <h3> <?php $thetitle = $post->post_title; $getlength = strlen($thetitle); $thelength = 33; echo substr($thetitle, 0, $thelength); if ($getlength > $thelength) echo "..."; ?> </h3>
Category: Web

Define multiple Gutenberg editor widths

I'm trying to define multiple widths for the Gutenberg editor depending on the post/page template. I have a full-width page template and would like the editing experience to be as close to the live page. Now the issue is that I can only seem to define one width for the editor using the .wp-block class. I'm following this method: https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#changing-the-width-of-the-editor .wp-block { max-width: 720px; } I've tried adding a selector in front of the .wp-block class, for example: .wp-block { …
Category: Web

TwentySeventeen $content_width not updated in admin

I've read many answers to the problem of modifying TwentySeventeen's content width, but this one aspect is eluding me. I have the following in my child theme's functions.php function childtheme_content_width( $content_width ) { echo '<script>console.log("$content_width was ' . $content_width . '")</script>'; if ( is_single() || is_admin() ) { $content_width = 800; } echo '<script>console.log("$content_width now ' . $content_width . '")</script>'; return $content_width; } add_filter( 'twentyseventeen_content_width', 'childtheme_content_width', 11); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'post-perfect' => __( 'Full …
Category: Web

How do I get both horizontal and vertical scroll bars in an HTML texbox

I have an issue that I can find how to setup vertical scroll-bars but not horizontal scrollbars. A couple of demos are at: https://www.w3schools.com/TagS/tag_textarea.asp https://stackoverflow.com/questions/19292559/how-to-scroll-text-area-horizontally I ran out of references. I am looking to have the box formatted within a table to handle 100% width of the table and the available height.
Category: Web

Why is Wordpress serving the 1024px version of my image and not the original on a 1920x1080 screen?

I have uploaded an image that is 2100px wide into a post, and inserted that image in the post body. I'm building a custom theme based on Wordpress' Twenty Sixteen. The HTML looks OK: <img class="alignnone wp-image-2669 size-full" src="http://.../wp-content/uploads/2017/07/GrillSommer1.jpg" alt="" width="2100" height="904" /> in the frontend, Wordpress does what I assume is its "responsive image" magic (I don't think I have added any plugins that would do this:) <img class="alignnone wp-image-2669 size-full" src="http://.../wp-content/uploads/2017/07/GrillSommer1.jpg" alt="" width="2100" height="904" srcset="http://.../wp-content/uploads/2017/07/GrillSommer1.jpg 2100w, http://.../wp-content/uploads/2017/07/GrillSommer1-300x129.jpg 300w, …
Category: Web

Can't extract and set SVG dimensions

Up to now, I have had no problems with the background-image thumbnails in my theme. However, now that I'm trying to use an SVG as the featured image, something is breaking. The problem seems to related to the width of the SVGs being returned as zero by wp_get_attachment_image_src(). So what I am I trying to do is figure out how to extract the width and height information from the SVG then set them to the appropriate values in the SVGs …
Category: Web

what is the width of my blog column?

My blog is voraciouslyyours.com I would like to know the width of my blog column. I have been told that I should make images "twice the width of my clog column" because the retina screens need the double width to display images crisply. I tried finding the width myself using this link http://www.bu.edu/tech/services/comm/websites/www/wordpress/how-to/find-area-width/, but got two different numbers when using chrome tools versus internet explorer. Can anyone verify for my the width of my blog column or help me find …
Category: Web

Set add_image_size() greater than content width in media box

How can I set a image size bigger then the defined max content width in the media box? The content width is set to: if ( ! isset( $content_width ) ) { $content_width = 960; } If I add now a picture with size bigger then the $content_with, it get scaled down. add_image_size( 'post-visual', 2048, 900, true ); The picture gets sized but at the moment it appears in the media box only with the dimensions of 960x421.
Category: Web

How to set a correct $content_width when there are two content widths on one page?

Currently I have 1860px wide image as featured image which shows on top of a post page, and 800px as post content width, and when I Set $content_width = 800 The featured image shows as 800px wide only Set $content_width = 1860 Featured image shows well, but embedded youtube video shows as 1860 x 1077, I tried to set max-width:100% on iframe, it fixed the width, but height still 1077, a height:auto has no effect. Any suggestion?
Category: Web

change the $content_width

I am creating a child theme based on 2016 I want to set new upload media images add_action( 'after_setup_theme', 'azm_add_image_size' ); function azm_add_image_size() { add_image_size( 'helen', 936 ); add_image_size( 'brian', 227 ); } add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'helen' => __( 'helen' ), 'brian' =>__( 'brian') ) ); } The small size, brian, works fine. However the large size is creating the correct image in the uploads folder eg 'bluehousefrontelevation-1-936x624.jpg' however, in …
Category: Web

$content_width in "twentyfifteen.1.4" WP Default tHEME

if ( ! isset( $content_width ) ) { $content_width = 660; } The above mentioned code exist in wordpress Default Theme Functions.php on line#33 My Question: $content_width It looks like a global variable defined somewhere in core files in wordpress? $content_width=660; what is 660 is it in pixel. Actually which content width is this setting? The current theme has this anatomy: sidebar and content area. Or it is effecting post and pages types?
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.