Posts tagged with keywords "Wordpress", page 2


Track these posts using the RSS Feed

Modifying the Wordpress query in your theme without breaking plugins


In the Wordpress codex, it explains how to modify what posts are in the loop by modifying the Wordpress Query object. However there is a catch with this, because by using rewind_posts() for example, you are generating a brand new query to the database that doesn’t trigger plugins.

Specifically this came up when creating the current theme for my webpage. I wanted to use my tdo-tag-fixes plugin that filters posts on a category template based on a tag. This initially worked fine, but I wanted to tweak the theme so that some category pages displayed all posts from that category but yet could be filtered by tags. (Check out my download section where you can filter downloads by clicking on the tag cloud on the left). Apparently other people are suffering similar problems too when they use the tdo-tag-fixes plugin while trying to modify the query within their theme.

To list all the posts in a category template isn’t hard at all. I just had to set the query var “nopaging” to true and do a rewind_posts(). (You also have to set the category_name again). Once I had implemented this in my category template, the tag filtering stopped working. What was happening was that rrewind_posts() created a brand new query, overwriting any previous set query vars and basically going around my tdo-tag-fixes plugin.

However there is a solution to this (basically how tdo-tag-fixes is implemented in fact). So what you need to do is modify the query before it gets to the template. This way it should be in addition to any other plugins that modify the query (unless your theme overwrites them).

So in my functions.php I did something like this:


add_action('parse_request','show_all_entries_in_category');

function show_all_entries_in_category(
    $args
)
{
    $categories_list = array( 1, 3, 4 );

    // this if checks if it's for a category template
    //
    if(isset($args->query_vars['category_name']))
    {

        $cat = get_category_by_path($args->query_vars['category_name']);

        // if one of the special categories, disable paging
        //
        if(in_array($cat->term_id,$categories_list))
        {
            // make sure all posts are displayed in this category
            //
            $args->set_query_var('nopaging',true);
        }
    }
}

This piece of code will check set the “nopaging” query var on the wp_query for categories with ids 1, 3 or 4, which means that for those category pages all posts will be listed with no previous and next page links.

You can of course alter the code with in show_all_entries_in_category() with what ever query modifications you need to do.

So, em, TDO Mini Forms… how have you been?


I have to apologise. When I saw that TDO Mini Forms was working fine in Wordpress 2.6, I kind of left it alone since coming back from the holidays. I’ve been spending my coding time on a new theme for thedeadone.net (enough of it is finished that its good enough to use), which isn’t that much with my wife in bed with the flu. However I have been keeping my eye on the support forums and helping out with advice and suggestions. Next week, I’m going get back into it (and let my nearly-finished theme stay as it is).

And there is lots to do! While TDOMF seems to work fine in WP 2.6+ there are a number of issues reported that I haven’t investigated yet and also I recieved some localised files for French from Laurent 3w3t to roll in. I plan to setup a localisation forum where people can upload .po files and I can upload .pot files in advances of big releases.

Anyway, all this to say that next week I plan to get back into active development of TDO Mini Forms! :)

Arg, how I hate Internet Explorer!


I don’t pretend to be a great web designer or programmer. Most of the stuff I do is really just tinkering and as part of that I decided it was time to create a new look for thedeadone.net, which involves creating a new “Theme” for Wordpress. About a week ago, I got the theme up and running, the layout done. I’ve kept adding configurable options so that I can use it as a standard Wordpress theme and also have it customised to how I think thedeadone.net should be done. I decided, as a first step, I’d change the colour scheme to match my previous theme, then install the new theme here and start using it.

A week later I’m ready to throw my laptop out the window. At first, I didn’t find it hard, modifying the CSS stylesheets to get the right look and spacing. I checked it in Opera and used Firebug in Firefox, everything was great. Then I tried it in Internet Explorer and elements were all over the place. Slight padding changes would shift around half the page, I had to start again, adding fixes and changes to get it to work in Internet Explorer. It sucks. It’s like writing code that is completely standards compliant but finding it doing utter different things on different operating systems.

Anyway, I’ve started to use the new theme here. It’s not finished, lots of stuff to do on it, but I’d rather see it in action than continue to work in the dark on it.

Read More…

A new look for thedeadone.net


I’ve been working on a new theme for thedeadone.net for a little while now. The functionality is about 90% there. The layout is 99% done. But there is about 50% more to go. I have to choose colours and modify the layout with icons and images to make it “pretty”. I also need to make it work for the forum so at least I have a similar theme across the two sites.

I’m actually very happy with it so far, but its been a lot more work than I anticipated. The current theme I have, I don’t like at all, even though I created it. Even though I haven’t done colours or images yet, I’m very tempted to actually start using the new one now, because the layout will greatly improve usability of my site.

If you have the time, check out our “Murder of Crows” gaming site where I have rolled out the unfinished theme and tell me what you think?

Update #1: (9.35am) Ah pants. Just as I posted this, “Murder of Crows” gaming site isn’t up any more. In fact Redbrick’s webservers seem to be done.

Making the content field WYSIWYG in TDO Mini Forms (using TinyMCE)


It’s becoming a common query about how to make the content field in a TDO Mini Forms WYSIWYG (”What-You-See-Is-What-You-Get”). A WYSIWYG editor is where you see that your input is bold when you set it to bold, instead of seeing it plain with bold tags around the text. This tutorial will run you through quickly how to set this up.

Update #1: There is a bug with this tutorial. There is an incompatiblity between the AJAX code in TDOMF and using TinyMCE. Please disable AJAX before proceeding with this tutorial. If you have already done this, please disable AJAX. Then reset the form and then re-do the steps in this tutorial.
Read More…

New Releases of TDO Mini Forms (0.12.3) and TDO Tag Fixes (0.5) avaliable…


in the usual places.

For TDO Mini Forms, lots of small bug fixes (including one that was preventing some unregistered users from using a form) plus an Auto Respond Email widget and the ability to get moderation emails even if you’ve turned of moderation for a form.

For TDO Tag Fixes, just some bug fixes that have been hanging around for a bit on my private test server. I also plan to do some extra work on this in the next while, specifically around adding a “Tag Surfer” widget. We’ll see how much time I get.

And because I’ve moved to a new host, I can include PayPal donation icon and my Amazon wishlist for those who’d like to see TDO Mini Forms and TDO Tag Fixes keep on improving…. :)

Security Risk in TDO Mini Forms v0.12: Upgrade to v0.12.2 ASAP!


Update #1: It’s not my day. In my rush to get v0.12.1 out, I copied in some broken code to SVN. Nothing critical, just prevents TDOMF from running. v0.12.2 fixes this.

I’ve discovered a security risk in v0.12 of TDO Mini Forms if you use Custom Fields and the “Append to Post” format option. This was introduced during the implementation of the Form Hacker. I’ve already prepared a fix (v0.12.1 v0.12.2) for this and it is now on Wordpress.org (but it may take a few minutes before you can download it).

I strongly advise anyone using v0.12 to upgrade as soon as possible. If you can’t currently upgrade, please consider downgrading to the v0.11.1 or disabling the plugin until you can upgrade to v0.12.1 v0.12.2.

I do not know if anyone has been exploited by this hole, however I would also recommend carefully checking the HTML of submissions done with v0.12 for any PHP tags that might have slipped in the post content or custom fields.

I apologise for this and hope no-one is inconvenienced by it.

Version 0.12 of TDO Mini Forms is out


I’ve just released TDO Mini Forms v0.12 (get it in all the usual places). You should soon be able to automatically update it in your Wordpress install. Loads of new features; initial release of Form Hacker, AJAX forms, Categories Widget now supports Checkboxes and Radio buttons, new template tags and more bug fixes. You can see the full changelog after the “more” link.

I’ve had to disable the form import/export for this release as it was not playing nice with Form Hacker. The tdomfinfo() is also adversely affected by Form Hacker. Apologises for this, will fix as soon as I can.

Whats next now is to finish off bits and pieces to do with Form Hacker and probably spend time doing bug fixes. For me, at least, the next big feature is Post Editing. I’ve long ignored it, but I have to tackle it soon before I start on all the other little things that need to be done. Up until recently, every time I started to think about Post Editing, I would get carried away with trying to imagine some sort of generic framework where I could add modules to submit/edit anything in WP. But I’ve restrained myself and plan to attempt to add Form Editing (with an option for delete) without trying to reinvent tdo-mini-forms. Also, I don’t see the point of doing more than Post edit/submit/delete.

Enjoy v0.12!

Read More…

Quick update on TDO Mini Forms


The Form Hacker is working! The soon-to-be-released new version of TDOMF will contain the first release of Form Hacker. With Form Hacker you can modify the outputted code of the Form, so you can move around fields from different widgets, change the “Post Text” text, format the form anyway you, add new PHP code, and many other things. It is quite powerful so be careful using it. The only limitation at the moment is that you can not modify the preview output or the Upload Files widget. I’m currently working on this and it may/may not be in the next release.

Also, with the Form Hacker, you can modify any and all messages that TDOMF prints out, such as the “your submission is now in moderation” or “you doesn’t have permissions to use this form” messages. The only limitation is that you can’t currently modify the messages from widgets, such as the notify-me emails. This is something I will be adding soon.

I’ve done some updates to the widgets too. The Text widget now supports several macros and can included PHP code for really advance stuff. The Categories widget can now display as checkboxes or radio buttons (thanks sillybean.net for that one).

And I’ve added two new options, the first one allows you to choose if you want to redirect to a submission after posting if moderation is disabled and set a fixed size for the log (several people reported issues with memory allocation and the log).

Hopefully by Friday, I’ll have version 0.12 out for you all. If you can’t wait, you can always grab the dev version which has the latest working code.

TDOMF is not dead!


It was just taking a break! My host went unexpectedly down for a little period and so the TDOMF support forums were down and so too were all my development and test sites. Which meant that I was unable to do any work on TDOMF during the down period, which is why people’s requests on the forums and Wordpress.org went by largely ignored by me. I saw them, but there was little I could do to answer them. I’ll should be back getting back into the swing of things by next week, depending on how much sleep I manage to recoup over the next week.

But before it all went down I had started work on several features. Specifically to do with the problem of spam. My host had upgraded their PHP version and suddenly the TDOMF image captcha no longer worked on the forums and I had to remove it, otherwise no-one could post. Suddenly spam appeared. The one-question-captcha widget had zero effect on it. So I turned on moderation to prevent any more slipping through. I now have a queue of genuine spam submissions for TDOMF, so I thought, why not implement Akismet integration now with some real data. And it was coming together before my host went down. Now that things are starting to get back up to speed, I can start to look at finishing this work. I also want to look at throttling submissions - as in allowing a max limit of submission per user (or IP) per set period of time. And also expanding the one-question-captcha to support multiple random questions. I would hope these combination of features would provide enough tools to handle spam.

I will also look at queueing approved/published TDOMF posts. More than one person has asked for such a feature. The idea being that when you approve a TDOMF submission, it’ll only publish after X time after the last published post, creating a queue of published posts.

I still have the Form Hacker and AJAX features half done, but they require a lot of tweaking so they won’t make it into the next release.

After that I’m seriously thinking about looking at editing (and deleting) posts functionality. It’ll be a big chunk of work, but the time may be right for it.

I also see that Wordpress has gone to 2.5.1. Time to upgrade again.

Anyway, it’s good to be back and please be patient while I get up to speed.