Skip to content

Tag: tags

How to disable wordpress html filter for posts and pages?

In some versions of WordPress there is a filter that strips some tags from the html code. If you want to remove this filter just open wp-includes/kses.php and find this row:

function kses_init_filters() {
    // Normal filtering.
    add_filter('pre_comment_content', 'wp_filter_kses');
    add_filter('title_save_pre', 'wp_filter_kses');

    // Post filtering
    add_filter('content_save_pre', 'wp_filter_post_kses');
    add_filter('excerpt_save_pre', 'wp_filter_post_kses');
    add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
}

and comment out the rows that you need:

function kses_init_filters() {
    // Normal filtering.
    add_filter('pre_comment_content', 'wp_filter_kses');
    add_filter('title_save_pre', 'wp_filter_kses');

    // Post filtering
    //add_filter('content_save_pre', 'wp_filter_post_kses');
    add_filter('excerpt_save_pre', 'wp_filter_post_kses');
    //add_filter('content_filtered_save_pre', 'wp_filter_post_kses');
}

Then if you save the post in html it’s OK, but if you switch to normal view and then go back to html view the tags could be stripped again. This hapens most likely from the MCE Editor and to resolve this issue you could install a plugin called TinyMCE Valid Elements or some similar plugin.

How to allow more html tags in the wordpress comments?

Scenario: I am using the tinymcecomments plugin to give some formatting capabilities to commenters. Also oEmbed for Comments is nice one – when you put a link to youtube or vimeo it automatically embeds the video.
With the latest WP update I realised the span tag was removed from comments; colors attributes are filtered by the kses filter.

Fix for a problem with Joomla K2 and sh404sef

First some explanation about the problem.

The situation is when you have a Joomla 1.5 site with sh404sef 2.1.4 component and you want to add additional section for a blog for example and you want to use K2 2.4 for this.

So in this case you have additional menu item called for example ‘blog’ where you see a blog of your K2 articles. But you also want to have the tags and the search.

The problem is that when you hit on a tag you go to the page with the tags but you don’t see the other modules for the ‘blog’ item (you are redirected to a page without Itemid).

The same is with the search results page.

And one additional fix for a prefix in the url for your K2 blog.

Modifying the Tags Results Page for Joomla K2 + Creating a K2 Template Over Ride

This is a handy little guide, if you want to change the way that your Tag Results page is displayed.
As default, when you click on a Tag Link in a K2 Item, it will produce a page showing all full items which have that particular tag.

Now, if you Items contain a lot of information or you have a lot of Items with the same Tag, you will end up with quite a long list.

This little guide will explain how to reduce the displayed data to show just a snippet of the Item information plus add a bit of extra information.

Firstly, we are going to have to modify the generic.php file, this is located on components/com_k2/templates/
Now, If you do not want to modify this core file, then you can create a new K2 template first.