Add Shortcodes To Sidebar

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).

  • How To Upload More Than 2Mb Default Limit By WordPress
    04/26/2014 Update with version 3.9 – sample .htaccess where /wp39/ is /blogname/ # BEGIN WordPress <IfModule mod_rewrite.c> <IfModule mod_php5.c> php_value upload_max_filesize 30M php_value post_max_size 30M </IfModule> RewriteEngine On RewriteBase /wp39/ RewriteRule ^index\.php$ – RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wp39/index.php </IfModule> # END WordPress for version 3.9 just edit the .htaccess and add these 2 lines just below <IfModule …> <IfModule mod_rewrite.c> <IfModule mod_php5.c> php_value upload_max_filesize 30M php_value post_max_size 30M </IfModule> When I import all my posts of a blog, sometimes it’s bigger than the 2MB limit by WordPress. Normally, it’s defined in the php.ini, but I don’t seem to have it. I found a way on the internet to fix it, adding some lines in the .htaccess of the WordPress directory. These are the codes. <IfModule mod_php5.c> php_value upload_max_filesize 30M php_value post_max_size 30M </IfModule>
  • Warning: Missing argument 2 for wpdb::prepare()
    With all the new database version and WordPress updates, sometimes I get the warning from the footer scripts. This time with the WP 3.6 update. Warning: Missing argument 2 for wpdb::prepare(), called in C:\xampp\htdocs\wp36\wp-content\themes\i2010techs13\footer.php on line 28 and defined in C:\xampp\htdocs\wp36\wp-includes\wp-db.php on line 992 The fix is to add the code to config.php file – anywhere. @ini_set(‘display_errors’, 0); This is the script I added to extract the date of the first post and the last post of my blog. <?php global $wpdb; $post_datetimes = $wpdb->get_row($wpdb->prepare(“SELECT YEAR(min(post_date_gmt)) AS firstyear, YEAR(max(post_date_gmt)) AS lastyear FROM $wpdb->posts WHERE post_date_gmt > 1970”)); if ($post_datetimes) { $firstpost_year = $post_datetimes->firstyear; $lastpost_year = $post_datetimes->lastyear; $copyright = __(‘Copyright &copy;&nbsp; ‘, ‘idog’) . $firstpost_year; if($firstpost_year != $lastpost_year) { $copyright .= ‘-‘. $lastpost_year; } $copyright .= ‘ ‘; echo $copyright; }
  • FancyBox 2
    Now FancyBox v2.1.5 is out, I’m experimenting 2.0.6.1, to me the old 1.3.4 is working quite well, the only thing I like about this FancyBox 2.0.6.1 is the full size image display with the helpers.js which is great. The buttons for gallery are very useful and jquery is the best for all users platforms. So, I still want to use FancyBox 1.3.4 with FancyBox 2.0.6.1 on the same website, I had to modify the FancyBox 1.3.4.js and put no-conflict for FancyBox 2.0.6.1. Now my website can use both Fancybox1.3.4 and 2.0. To install this on WordPress, we need to add all the scripts before the </head> of the theme header.php. If we’re going to use players like Jwplayer or nonverblasters, we need to include them in this block also. As the rule of thumb, if we’re going to use many scripts, it’s good to have JQuery.noConflict defined for each script we use. For our FancyBox we use $jQ as the alias for $ sign. The scripts that will run all FancyBox classes is in the “idogfb2061.js” (this is a custom script that I created for FancyBox2.0.6.1). I like to use FancyBox because it’s supported by almost all devices out there. <!-fancybox 2.0.6.1–> <script ...
  • Record With Mixed Audio In Windows 7 and 8
    These days, with new Windows 7 or Windows 8, depends upon which audio chipset driver is used, our mixed audio recording is gone out of the mixer. It’s actually hidden because it was disabled by the OS as default. So, why do we need this mixed audio recording? mixed audio recording is the ability to record everything that we can hear through our speakers or head phones, it records all sounds from all input sources. Example, I’m playing a Karaoke midi on my computer, I use my microphone to sing along – if the mixed audio recording doesn’t exist, I can only choose the microphone as default and there won’t be any music with the song. Now if I can turn on mixed audio recording, I will be able to hear my voice and the midi mixed together and the sound system also (so I must mute the sound system – ie – email notification … etc). In order to find if I have that mixed audio option, click the speaker icon on the task bar –>mixer–>System Sounds–>Recording–>right – click–>Show disabled devices–>click Stereo Mix–> right click–>Enable–>test with audacity or sound recorder.                   Use audacity to record – ...
  • Page Jumps – Splitting Content
    Sometimes I write a very long post and I don’t really want to paginate it, I want to have a list of topics and each topic will jump to the correct content on the same page. This is the way to do it. 1. We need to create IDs for these topics (links) – place the <a href=”#topic1″>topic1</a> as the link. 2. Create anker point where topic1 link should jump to.<a id=”topic1″>this is topic1 where the link should jump to<a> A. Topic1. Link to anker (where this link will jump to) = <em><a href=”#topic1″>A. Topic1.</a></em> B. Topic2. C. Topic3. Topic1 <a id=”topic1″></a><br/> !!! Put this anker with empty line for the link to jump to the title “Topic1″ <p style=”text-align: center;”><em>Topic1</em></p>   Blah blah blah   Topic2 <em><a href=”#topic2″>B. Topic2.</a></em>   This is topic 2   Topic 3 <em><a href=”#topic3″>C. Topic2.</a></em>   This is topic 3 Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *