Wordpress 2.7 final to be released

3 Dec

If you use wordpress, you may be happy. The 2.7 will go final in two days from now. The good news is this: old browsers are not supported anymore. Yes, IE6 is included in “old browser” category!

I already update this blog to 2.7 RC because i just messed up feed.

What i did? Well.. In my “have more money than Bill Gates” race, i wanted to put some ads in RSS feeds. I set up this in adsense account but… The problem is that i screw things up :( Ads are displayed, but in reader you can see a small excerpt. I spend over two hours to find a fix (including removing the ads!) but with no luck. So… If you know how to fix and you want to help me, be my guest!

Tags: Comments (2)

Bookmark this article!

Del.icio.usDiggStumbleUponFurlRedditTechnorati

SlashDotWindows LiveYahooGoogleFacebookBlogLines

Very *effective* antispam trick on blogs

21 Oct

Most of bloggers have a problem with spam. Of course, there is Akismet, but sometimes Akismet is not good enough because he doesn’t catch all spam messages. So, with this in mind, i wanted only to get rid of all automated messages.

So, look what i did:

First of all, i go with „robots fills ALL fields with something” in my mind. I’ve added only TWO lines of code: one in comments.php from your theme folder and one in wp-comments-post.php from your root folder.

Ok, how you do it?

First of all you need a ftp client and a text editor. E-texteditor is 2 in 1 so you can download a trial version for doing this. Ofcourse, you can use the old and ugly notepad (or whatever your OS has default).

Open comments.php (which is in your wp-content/themes/your_theme_name folder) then find this line:

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

Some things can vary (like ID of the form), but 90% in cases you won’t need to look for something else ;)

Just AFTER this line you add:

<p style="position:absolute; left:-9999px;">Don't fill this! <input type="text" name="name2" /></p>

We put a form here and hide it. I didn’t use display:none because i wanted to be sure that field will be showed up, even is on the left side of the screen (you should actually turn you head to left to see it :P ) So the bot will actually SEE that form and will fill. Normal user won’t.

Save and upload (or just save if you work directly on ftp) then open wp-comments-post.php from your root folder. Just after the

<?php
/**
 * Handles Comment Post to WordPress and prevents duplicate comment posting.
 *
 * @package WordPress
 */

beginning part, just add this:

if( $_POST['name2']!= ''){
	die('Spammer!');
}

Save and upload.

Next you need to… Hmm… You don’t need to do anything else ! Now empty your Akismet queue and wait to see if you get any other spam messages ;)

Note that is possible to not catch ALL spams, but those are automated you won’t get it anymore :) Also, when you upgrade wordpress make sure you make those changes again. And finally, BACK UP FIRST!

Tags: , Comments (6)

Bookmark this article!

Del.icio.usDiggStumbleUponFurlRedditTechnorati

SlashDotWindows LiveYahooGoogleFacebookBlogLines

Advanced Carousel

1 Aug

Ok, as ai said you before, i want to make a tutorial about a more advanced carousel than previous was.

I won’t explain HTML and CSS code (is very simple and intutive):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<div class="carousel">
	<div class="ctrls">
		<a href="#" class="prev">Previous</a>
		<a href="#" class="next">Next</a>
	</div>
<ul class="clearfix">
	<li><img src="http://farm4.static.flickr.com/3164/2719962411_77cf9e1699_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3159/2720786298_d33f97bfcd_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3280/2719962373_f49bb3e2a2_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3001/2720787742_d2f263372c_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3046/2720787680_8f358f938e_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3108/2719963843_f2e963af8f_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3141/2719965289_83902cf96c_t.jpg" alt="" /></li>
 
	<li><img src="http://farm4.static.flickr.com/3164/2719962411_77cf9e1699_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3159/2720786298_d33f97bfcd_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3280/2719962373_f49bb3e2a2_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3001/2720787742_d2f263372c_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3046/2720787680_8f358f938e_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3108/2719963843_f2e963af8f_t.jpg" alt="" /></li>
	<li><img src="http://farm4.static.flickr.com/3141/2719965289_83902cf96c_t.jpg" alt="" /></li>
</ul>
 
 
</div>

CSS file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
* {margin:0;padding:0;}
 
.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix {display:inline-block}
/* Hide from IE Mac \*/
.clearfix {display:block}
/* End hide from IE Mac */
* html .clearfix {height:1px}
.carousel {
	position: relative;
	overflow:hidden;
	height:500px;
	width:540px;
	margin:50px auto
}
	.carousel .ctrls {
		margin:10px
	}
	.carousel ul {
		position: absolute;
		width:8000px;
	}
		.carousel li {
			float:left;
			width:98px;
			height:98px;
			border: 1px solid #fff;
			list-style:none;
			margin-right:10px;
			text-align: center;
		}

The good part of this carousel is that you can have as many as you want in your page. You can have both fixed and fluid width and will work with no problem. Or at least no problem: on fluid layout, some images can be cutted. So, the best use is fixed width. Also, you can have autoscroll (with timers, i will say more later), but is not recommended because you may encounter some performance troubles.

After we include last version of jQuery, we have to do these things:

1) Iterate trough all .carousel containers (if you want to pick another name, this is the place and this is also the time!) and set the width.

1
2
3
4
5
$('.carousel').each(function(){
	var _this=this;
	var elWidth = $(_this).find('li:eq(0)').width()+12;
	$(_this).find('ul').width(elWidth*$(_this).find('li').length).css('left', 0);
});

We assume that all LI have same width, 10px margin and a border. So we adjust the width with 12 px (2px from border). If you have a wider margin (or none) change it, otherwise you will have some serious problems :D

The previous/next buttons we will control with a separate function, because we don’t have double scroll on double click, right? We put the function INSIDE of the each loop:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function carouselCtrls () {
	$(_this).find('a.prev').unbind().click(function(){
		$(this).unbind();
		if(parseInt($(_this).find('ul').css('left'))<0) {
			$(_this).find('ul').animate({
				left: '+='+elWidth
			}, function(){
				carouselCtrls();
			});
		}
		return false;
	});
	$(_this).find('a.next').unbind().click(function(){
		$(this).unbind();
		var maxWidth = (parseInt($(_this).find('ul').width())-$(_this).width()-10)-(-parseInt($(_this).find('ul').css('left')));
		if(maxWidth>0){
 
		$(_this).find('ul').animate({
			left: '-='+elWidth
		}, function(){
				carouselCtrls();
			});
		}else {
			$(_this).find('ul').animate({left:0},function(){
				carouselCtrls();
			});
		}
		return false;
	});
	};


Let see how it works (i will explain only one link because the other one works same - but reverted):
(more…)

Tags: Comments (3)

Bookmark this article!

Del.icio.usDiggStumbleUponFurlRedditTechnorati

SlashDotWindows LiveYahooGoogleFacebookBlogLines

Wordnewz Wordpress theme

3 Jul

Well.. is done :) The Wordnewz is finally done.

As i said, there is two version of theme: free and premium. Read below to see the differences.

Preview:

Free theme :

  • You have to edit all files to make some changes. For ads you need to edit files from ads folder. For index settings you need to change index.php
    • For featured slider: find
      &lt; ?php $my_query = new WP_Query('tag=featured&amp;showposts=3');

      featured - enter tag slug and how many slides you want

    • For small excerpts find:
      $my_query = new WP_Query('category_name=economy&amp;showposts=3');

      Change category_name according to your category slug

  • Images is added width custom fields with 130×130px for index and 200×150px for inner slider
  • Plugin settings
  • Print This
  • Email this
  • Excerpt length: 150

Download here.

What about premium version?

When you purchase the premium version you will have:

  • Technical support
  • Install/configure wordpress theme and plugins
  • Small changes of theme (colours, sizes, etc)
  • Admin panel for theme
  • RSS for each category
    • mail: slice [@] iamntz. [] com
    • y!messenger: i0nutzb
    • skype: i0nutzb
  • The price for premium theme is $50 and for more details you can contact me here:

    For now i don’t have an automatic way for purchasing, but i will reply you ASAP.

Tags: , Comments (0)

Bookmark this article!

Del.icio.usDiggStumbleUponFurlRedditTechnorati

SlashDotWindows LiveYahooGoogleFacebookBlogLines

Wordpress get_posts() function

30 Jun

Today i spent some time trying to figure how to get existing (and also used) tags from wordpress and using in admin panel as a combo box, for my brand new theme Wordnewz.

The return of get_tags() function was some kind of array but, because of my skills (not) in PHP i spend WAY too much time to go figure what to do. The initial result of get_tags() function is:

Array
(
    [0] => stdClass Object
        (
            [term_id] => 28
            [name] => Featured
            [slug] => featured
            [term_group] => 0
            [term_taxonomy_id] => 29
            [taxonomy] => post_tag
            [description] =>
            [parent] => 0
            [count] => 6
        )
)

And i only needed [name] and [slug]. Ofcourse, like a smart guy that i am, i pointed my browser on wordpress codex where i found… NOTHING. Nothing about this function… Great. Let’s try various stuff and google it for any ideas. And i found a PHP function get_object_vars for easy conversion. After this, all was GREAT. I use it like this:

1
2
3
4
5
$allTags = get_tags();
foreach($allTags as $thisTags) {
		$thisTag = get_object_vars($thisTags);
		echo '<option value="'.$thisTag['slug'].'">'.$thisTag['name'].'</option>\n';
}

And it WORKS like a charm. I posted this thing because i didn’t found too much references for stdClass Object or get_tags() Wordpress function.

Tags: , Comments (1)

Bookmark this article!

Del.icio.usDiggStumbleUponFurlRedditTechnorati

SlashDotWindows LiveYahooGoogleFacebookBlogLines

Older Posts »