How to set cookies to switch style sheets when a link is clicked and set it till another particular link is clicked?

You can use init action to set cookie, and other init action to read it. However due its a cookie… you will need also to check GET variable. add_action(‘init’, ‘is_it_mobile_or_desktop’, 1); function is_it_mobile_or_desktop(){ if (isset($_GET[‘site’]) && in_array($_GET[‘site’], array(‘mobile’, ‘desktop’)) ) { setcookie( ‘site’, $_GET[‘site’], time() – YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN ); } } add_action(‘init’, ‘who_am_i’, 2); … Read more

Fuzzy Images in WordPress 4.4

The new responsive images feature takes some tweaking to make it work optimally. The standard settings work only for the most basic of themes. Read up on responsive images, specifically the srcset and sizes attributes. Manipulate the srcset and sizes values through the new wp_calculate_image_srcset and wp_calculate_image_sizes filters. There’s also a max_srcset_image_width filter that allows … Read more

Responsive Video Max-width

So, apparently, I needed to read a little bit more before I posted my question. After I posted the question, I ran across: https://moodle.org/mod/forum/discuss.php?d=258650, which is what I incorporated into the code I was using. I modified my function to look like: function video_embed( $html ) { return ‘<div class=”video-container”><div class=”video-wrap”>’ . $html . ‘</div></div>’; … Read more

How to make wordpress theme iframe responsive

After some research, I came across this article and ended up with the solution below. <div style=”position: relative; padding-bottom: 56.25%; padding-top: 25px; height: 0;”> <iframe style=”position: absolute; top: 0; left: 0; width: 100%; height: 100%;” src=”http://slither.io/” width=”100%” height=”100%” frameborder=”0″ scrolling=”no” seamless=”seamless” allowfullscreen=”allowfullscreen”> </iframe> </div> What this code does is that it set the div’s width … Read more

Convert WP Menu to a Drop Down for Mobile browser

Here’s what I’ve put together from different articles/themes: files to modify: functions.php header.php style.css js (create folder “js” in theme root directory) The Javascript: jQuery(function() { jQuery(“<select />”).appendTo(“nav”); jQuery(“<option />”, { “selected”: “selected”, “value” : “”, “text” : “Go to…” }).appendTo(“nav select”); jQuery(“nav a”).each(function() { var el = jQuery(this); jQuery(“<option />”, { “value” : el.attr(“href”), … Read more

Can’t show custom post thumbnail sizes as background images

Use this. you will need to call thumbnail sizes. $small_regular = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), ‘small_regular’ ); $big_regular = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), ‘big_regular’ ); echo “<style type=”text/css”>”; echo “.entry-featured-image { background-image: url(‘” . $big_regular[0] . “‘); }”; echo “@media screen and (max-width:48em) { .entry-featured-image { background-image: url(‘” . $small_regular[0] . “‘); } }”; echo “</style>”;

What controls responsiveness in WordPress?

WordPress has absolutely nothing to do with responsiveness, neither does themes or plugins. Responsiveness is controlled by media queries (CSS) set in stylesheets and the particular browser the site is viewed in. It is here where screen sizes are determined and checked against available media query rules. Just one note, older browsers like IE6, 7 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)