I can’t seem to install Font Awesome locally [closed]

Considering the folder structure “/public_html/wp-content/themes/TestTheme/static/fontawesome/” as folder location for Font Awesome use following instead 1 use following instead of the one you used for js include <script defer src=”https://wordpress.stackexchange.com/questions/299868/<?php echo get_template_directory_uri(); ?>/static/fontawesome/fontawesome-all.js”></script> 2 use following instead of the one you used for CSS include having fontawesome.min.css file in the CSS folder <link rel=”stylesheet” href=”https://wordpress.stackexchange.com/questions/299868/<?php echo … Read more

Way to store featured image width and height in two separate variables?

You can always use the wp_get_additional_image_sizes() function to retrieve an image “size” (i.e. width, height, and the ‘crop’ option), like this: $image_sizes = wp_get_additional_image_sizes(); if ( isset( $image_sizes[‘slide_image’] ) ) { $size = $image_sizes[‘slide_image’]; var_dump( $size ); // Demo echo $size[‘width’]; // Demo } UPDATE In reply to your comment, i want to get the … Read more

Check if the image size is available and if not use ‘full’ image size

I don’t see why something like this wouldnt work! $med_post_thumb = get_the_post_thumbnail($post->ID, ‘medium_post_thumbnails’, array(‘class’ => ‘img-fluid’)). ‘</a></div>’; $full_post_thumb = get_the_post_thumbnail($post->ID, ‘FULL SIZE GOES HERE’, array(‘class’ => ‘img-fluid’)). ‘</a></div>’; if ($med_post_thumb == NULL) { echo $full_post_thumb; } else { echo $med_post_thumb; }

Widget back end radio button issue

You got that problem because the radio buttons have different name; i.e. the_style_1 and the_style_2. So I’d suggest you to use the_style as the name for both the radio buttons: <p> <input class=”radio” type=”radio” <?php checked( $instance[ ‘the_style’ ], ‘style_1’ ); ?> id=”<?php echo $this->get_field_id( ‘the_style_1’ ); ?>” name=”<?php echo $this->get_field_name( ‘the_style’ ); ?>” value=”style_1″ … Read more

How to retrieve the current post’s generated featured image size?

Have a look to wp_get_attachment_image_src(), which gives precisely data you need (URL and dimensions). Which help to figure out your problem. sample code $image_attributes = wp_get_attachment_image_src( $attachment_id = 10 ); if ( $image_attributes ) : ?> <img src=”https://wordpress.stackexchange.com/questions/302831/<?php echo $image_attributes[0]; ?>” width=”<?php echo $image_attributes[1]; ?>” height=”<?php echo $image_attributes[2]; ?>” /> <?php endif; ?> The return … Read more

add_action template_redirect not working for home page

Be careful not to confuse the two query conditionals. Whether is_home() or is_front_page() return true or false depends on the values of certain option values. When using these query conditionals: If ‘posts’ == get_option( ‘show_on_front’ ): On the site front page: is_front_page() will return true is_home() will return true If assigned, WordPress ignores the pages … Read more

Warning: call_user_func_array() expects parameter 1 to be a valid callback

The warning is clear: Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘cookie_GA’ not found or invalid function name in C:\wamp64\www\wordpress\wp-includes\class-wp-hook.php on line 286 So cookie_GA() is not found. When can this be the case? Well, of course when is_allowed_cookie(‘_ga’) is false. So either wrap the add_action() call inside that if as … Read more

Changing parent element’s class or style

So, the elements should be changed into <div class=”icheckbox disabled hide_empty” style=””> that’s different from the goal stated in the question where you say you want to add class “hide_empty” to the parent <li> of the <div class=”icheckbox”>. The code posted by @dhirenpatel22 should work to add class hide_empty to the li element, of course … Read more