Since WordPress is php based, in order to use shortcodes on the sidebar or anywhere on the theme, we have to use echo.
<h2><?php echo do_shortcode(‘ catlist categorypage=yes excerpt=yes excerpt_size =255)]’); ?></h2>
This is the shortcodes for catlist to list related posts in the same category on the sidebar for my single.php that I’m designing right now (the right bracket before ‘catlist’ is missing).
- Embed Youtube Iframe VS HTML5 TestThe website loading is critical for users to access with mobile devices, my websites do have many youtube videos embedded. The new way is iframe embed and the expert do recommend NOT to use. I found another way to embed youtube videos without using the iframe and it’s supposed to load faster. The labnol.org shows how to do it. I modify the original script to add full screen option. I’m loading these 3 youtube videos to compare the loading time with the same html5 embedded ones. function labnolIframe() { var iframe = document.createElement(“iframe”); iframe.setAttribute(“src”, “//www.youtube.com/embed/” + this.parentNode.dataset.id + “?autoplay=1&autohide=2&border=0&wmode=opaque&enablejsapi=1&controls=1&showinfo=1”); iframe.setAttribute(“allowfullscreen”, “1”); iframe.setAttribute(“id”, “youtube-iframe”); this.parentNode.replaceChild(iframe, this); } I created a shortcodes.php to embed the youtube id easily. “myutube id=”youtube_id”
- Embed Youtube Video Iframe VS HTML5The website loading is critical for users to access with mobile devices, my websites do have many youtube videos embedded. The new way is iframe embed and the expert do recommend NOT to use. I found another way to embed youtube videos without using the iframe and it’s supposed to load faster. The labnol.org shows how to do it. I modify the original script to add full screen option. I’m loading these 3 youtube videos to compare the loading time with the same iframe ones. function labnolIframe() { var iframe = document.createElement(“iframe”); iframe.setAttribute(“src”, “//www.youtube.com/embed/” + this.parentNode.dataset.id + “?autoplay=1&autohide=2&border=0&wmode=opaque&enablejsapi=1&controls=1&showinfo=1”); iframe.setAttribute(“allowfullscreen”, “1”); iframe.setAttribute(“id”, “youtube-iframe”); this.parentNode.replaceChild(iframe, this); } I created a shortcodes.php to embed the youtube id easily. “myutube id=”youtube_id”
- HP Error Code 0xc0000225 BSODFor some unknown reasons, sometimes my HP Envy 4-1117nr came up with a blue screen with Error Code 0xc0000225. It doesn’t matter what I do, it always come back up to the same screen until I let it sits by itself until it turns off the laptop. Then I can boot again to whatever the selection I wanted. So, if you get the screen, don’t reboot, don’t do anything like it recommends, just let it sits and shut itself off and then you can boot with F9 to select different devices to boot from.
- How To Split Prefix Database To Individual Database For WordPressAlright, I had a few blogs sharing the same database by using prefix database in WordPress and the blogs are getting bigger and the single database getting larger. The problem is that every time the database goes down, all blogs go down which is not good for my website. I don’t want to re-install WordPress blog and lose all shares data and stuff. The only way to keep everything the same is to point the blog to the same exact database at the moment. So, before I write any new posts, updated everything and start to export/import database process for my blogs. First, we need to find out from the blog which prefix “wp_xxx” was set in the wp-config.php. My main database has 3 blogs in them with 3 prefixes wp_audi, wp_svlife and wp_family. I need to export all tables in wp_svlife, wp_audi, wp_family to sql files then import them all to a newly created database. When it’s done, all I need to is to change the database in the wp-config.php with the new database and same prefix wp_svlife and it’s done. If the sql files are bigger than 50Mb, use 7-zip to zip them smaller. phpMyAdmin ...
- Author Avatar Picture In WordPress 3.9.XMy aunt asked me to show her picture on her WP blog for author instead of these self generated avatar. After searching on the internet, here is how I did it for her. The code needed in the functions.php of the theme. The code needed in the loop (main) and loop-single (post). <?php echo get_avatar( get_the_author_email(), ’60’ ); ?> 60 is the size of the image in pixels. loop <span class=”comments-link”><?php comments_popup_link( __( ‘Leave a comment’, ‘twentyten’ ), __( ‘1 Comment’, ‘twentyten’ ), __( ‘% Comments’, ‘twentyten’ ) ); ?></span> <?php edit_post_link( __( ‘Edit’, ‘twentyten’ ), ‘<span class=”meta-sep”>|</span> <span class=”edit-link”>’, ‘</span>’ ); ?> <?php echo get_avatar( get_the_author_email(), ’60’ ); ?> loop-single <div class=”entry-meta”> <?php twentyten_posted_on(); ?> - <?php twentyten_posted_in(); ?> <?php the_views(); ?> <small><span class=”st_sharethis_hcount”></span></small><div class=”fb-like” data-href=”//www.tambl.net” data-send=”false” data-layout=”button_count” data-width=”450″ data-show-faces=”true” data-font=”lucida grande” data-colorscheme=”dark”></div> <?php echo get_avatar( get_the_author_email(), ’60’ ); ?> We do need avatar picture loaded, I use Author Image plug-in, it’s easy to use.