Categories
Blog

24 Pictures You Haven’t Seen Yet From Vienna

Categories
WordPress

Show the Featured Image Inside A Post On A Site Using Shortcode

If you are looking how to insert a featured image inside a post, you can try the following solution.

 Add the following code inside the functions.php of your theme:

add_shortcode('thumbnail','thumbnail_in_content');
function thumbnail_in_content( $atts ) {
global $post;
return get_the_post_thumbnail( $post->ID );
}

Control the features images with the shortcode:

[thumbnail size=medium align=right]

The side can be changed to small, medium and large values and/or align can be none, center, right or left.

Another way to control the thumbnail size with size=’array( 300, 200)’. It will look like this

[thumbnail size='array( 300, 200)']

Change the array value to a different number to achieve the result you need.

Categories
WordPress

Update URLs Through phpMyAdmin After Site Migration

So you’ve migrated a site to a new host with a new domain and forgot to change the site’s URLs. No worries a simple solution you can try is to change them within the phpMyAdmin.

Go to your cPanel and locate the phpMyAdmin icon. Click on it and you will be redirected to it.

Default caption

 

Make sure you have the new database selected, then run some sql updates and replacement commands on the tables notably, wp_options, wp_posts, wp_postmeta.

Don’t forget to replace wp_ prefix with your own 😉

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');