Category Archives: PHP

Resolving WordPress Twenty Thirteen Disqus Plugin placement issues

WordPress’ new 2013 theme is fantastic, but if you’re also using the Disqus plugin, it’s quite likely you’ve noticed an issue with its placement.

Rather than sitting nicely under the main content, it spreads out and occupies the space visually reserved for the sidebar. forum thread details some fixes, but I found a quick CSS addition fixed the problem.  Simply add this to the bottom of the 2013 Theme’s stylesheet:

#disqus_thread {
    max-width: 1040px;
    padding: 0 376px 0 60px;

This should push the area under the left column and respond appropriately.

I also made a small change to the single.php file, because I feel the ‘post nav’ is better suited to being placed after the comments.  Simply modify the loop of that file to this:

<?php while ( have_posts() ) : the_post(); ?>
  <?php get_template_part( 'content', get_post_format() ); ?>
  <?php comments_template(); ?>
  <?php twentythirteen_post_nav(); ?>
<?php endwhile; ?>

I swapped the order of the comments_template() and twentythirteen_post_nav() function calls.

Hope this helps!

Professional CodeIgniter Book Review

With all the furore surrounding Ruby on Rails, you’d be forgiven for forgetting that any other web application framework ever existed. The fact is, of course, that there are many to choose from, and one leading PHP-based framework is MVC-based CodeIgniter.

The CodeIgniter website is a great place to start for newcomers and more experienced developers alike, but I still like a good book, that I can hold in my hand and digest. Wrox’s Professional CodeIgniter is such a book, and presents a good overview of the framework that’s getting deserved attention in the web development community.

The book weighs in at a fairly lightweight 336 pages, but covers various aspects of CodeIgniter development, together with a history of the Model View Controller Pattern and an examination of Agile Development that is often employed by modern web-centric development teams. Whilst these discussions are not completely necessary to experienced programmers looking at getting to grips with CodeIgniter, they may benefit others who are looking for a more rounded introduction to web development. Being familiar with MVC and agile-development, I skipped these sections and headed for some CodeIgniter code.

Chapter 3 satisfies my code craving, where an overview of CodeIgniter is presented, covering such topics as the default installation, configuration, CodeIgniter libraries, helpers, and models, views and controllers, the foundation of any CodeIgniter site.

Chapters 4-8 walks through the development of an e-commerce style website with a shopping cart, categories and products, and a dashboard for managing details of the site. Chapter 9 covers some security issues, and although the information is presented, it is not intended as an exhaustive coverage of PHP Security. There is never a one book fits all situation, and for PHP security, you’re likely to find Essential PHP Security of great use.

The book concludes with an brief examination of the site launch, though this adds little of any significant importance.

It’s good to see a CodeIgniter book, and the quality of the writing is generally high, with easy to follow code examples. The book is very thin on AJAX coverage, which is quite a negative. Used in conjunction with the excellent CodeIgniter forums and website, it’s likely to prove a great resource for learning the framework.

The book’s list of Chapters is as follows:

  1. Welcome to the MVC World
  2. Agile Methodologies and Approaches
  3. A 10,000-Foot View of CodeIgniter
  4. Creating the Main Website
  5. Building a Shopping Cart
  6. Creating a Dashboard
  7. Improving the Dashboard
  8. Last-minute Upgrades
  9. Security and Performance
  10. Launch