Custom widget on selected pages in Thesis WP


/ Published in: PHP
Save to your folder(s)

This code to be added to custom_functions.php May also need to add to custom.css to style your custom widget. (This code found towards the end of the article).


Copy this code and paste it in your HTML
  1. /* My Custom Widget */
  2. 02.
  3. 03.add_action('widgets_init', 'my_text_widget_init');
  4. 04.
  5. 05.function my_text_widget_init() {
  6. 06. register_sidebar_widget('My Custom Widget', 'my_text_widget');
  7. 07.}
  8. 08.
  9. 09.function my_text_widget() {
  10. 10.if (is_page('about')) {
  11. 11.?>
  12. 12.<li class="widget">
  13. 13. <div class="my_widget_header">
  14. 14. <h3>Pacific Cruise Line</h3>
  15. 15. </div>
  16. 16.<div id="widget_content">
  17. 17. <img class="widget_icon" src="<?php bloginfo('template_url'); ?>/custom/images/calendar_128.png" height="100px" alt="Coffee?" />
  18. 18.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mollis, turpis suscipit sodales congue, magna urna egestas erat, vitae pulvinar tortor lorem vitae dolor. Ut sed mauris nisi.
  19. 19.</div>
  20. 20.</li>
  21. 21.<?php
  22. 22.}
  23. 23.}

URL: http://www.fouroclockproject.com/2009/advanced-sidebar-widget-styling-for-thesis/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.