how to base64 encode images in wordpress template

in your file functions.php in your template put this funcitons /** * @param $path * @return string * @author https://github.com/ozzpy */ function imageEncode($path) { $path = __DIR__.”https://wordpress.stackexchange.com/”.$path; $image = file_get_contents($path); $finfo = new finfo(FILEINFO_MIME_TYPE); $type = $finfo->buffer($image); return “data:”.$type.”;charset=utf-8;base64,”.base64_encode($image); } /** * @param $path * @return string * @author https://github.com/ozzpy */ function imageEncodePath($path) { $image … Read more

Pros and cons of using [taxonomy name] in place of [category name]?

For the SEO part you might get better answers on the Pro Webmasters Stack Exchange. I will focus on the performance. From your example I assume your permalink structure was %category%/%postname%/. Because of the way WordPress parses the incoming URL, this will result in verbose page rules, which means that each page (not post) you … Read more

Change the Permalink for wordpress attachment

Your rule works with the attachment ID, so I’m not sure how you’re using the title, but the answer is almost identical in either case. The filter you want is attachment_link: function wpd_attachment_link( $link, $post_id ){ $post = get_post( $post_id ); return home_url( ‘/images/’ . $post->post_title ); } add_filter( ‘attachment_link’, ‘wpd_attachment_link’, 20, 2 ); Change … Read more

A plugin for having rel=”nofollow” in posts?

you can add a filter in your functions.php add // Nofollow in content add_filter(‘the_content’, ‘my_nofollow’); function my_nofollow($content) { //return stripslashes(wp_rel_nofollow($content)); return preg_replace_callback(‘/<a[^>]+/’, ‘my_nofollow_callback’, $content); } function my_nofollow_callback($matches) { $link = $matches[0]; $site_link = get_bloginfo(‘url’); if (strpos($link, ‘rel’) === false) { $link = preg_replace(“%(href=\S(?!$site_link))%i”, ‘rel=”nofollow” $1’, $link); } elseif (preg_match(“%href=\S(?!$site_link)%i”, $link)) { $link = preg_replace(‘/rel=\S(?!nofollow)\S*/i’, ‘rel=”nofollow”‘, … Read more

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