Categories
Tutorial

Add Pagination to your WordPress Blog without Plugin!

Previously I gave you guys a tutorial about how to add a featured post section to your WordPress Blog.
This time I’ll be giving you yet another tutorial in which you can add a pagination to your WordPress blog without any plugin.
If you want to see a live demo click here

Steps

1. Configuring functions.php.

Add the following code to the theme file functions.php at the end unless you know where to add the code.

ADVERTISEMENT
function dw_paginate() {
        global $paged;
        $on_page = intval($paged);
        $no_prev = false;
        $no_next = false;
        if ($on_page == 0) {
            $on_page = 1;
        }
        global $wp_the_query;
        $max_pages = $wp_the_query->max_num_pages;
        $start_pos = $on_page - 2;
        if ($start_pos <=  0) {
            $amt_from_zero = ($start_pos * $start_pos) + 1;
            $start_pos = 1;
        }
        $end_pos = $on_page + 2;
        if ($end_pos >= $max_pages) {
            $amt_from_end = $end_pos - $max_pages;
            $end_pos = $max_pages;
        }
        if (isset( $amt_from_zero ) && isset( $amt_from_end )) {        }
        elseif(isset( $amt_from_zero )) {
            $end_pos = $end_pos + $amt_from_zero;
            if ($end_pos >= $max_pages) {
                $end_pos = $max_pages;
            }
        }
        elseif(isset( $amt_from_end )) {
            $start_pos = $start_pos - $amt_from_end;
            if ($start_pos <=  0) {
                $start_pos = 1;
            }
        }
        if (($on_page - 1) <= 0) $no_prev = true;
        if (($on_page + 1) > $max_pages) $no_next = true;
        $links_to_print = ($end_pos - $start_pos) + 1;
        echo '

' . "n";
    }


Now the code is added. So next up is to design how it looks.

2. Styling the output.

The following is the screenshot how it will be looking for the CSS code I’m going to give you. Basically the colour scheme was made as to suit Deepak’s blog MobileGyaan as I designed the current theme for his blog 😀 .

#pagination{clear:both;padding:15px;text-align:center;font-size:12px;font-weight:bold;color:#999;margin:10px auto 10px auto;}
#pagination li{margin:0 1px 0 1px;display:inline;list-style-type:none;}
#pagination li a{padding:5px 7px 5px 7px;color:#3399CC;border:1px solid #CCC;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
#pagination li a:hover{text-decoration:none;padding:5px 7px 5px 7px;color:#0066cc;border:1px solid #0066CC;background:#Daf2fc;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
#pagination .active a{background:#3399CC;color:#FFF;border:1px solid #0364ae;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
#pagination .extreme a{border:0;color:#3399CC;font-size:14px;}
#pagination .extreme a:hover{border:0;color:#3399CC;font-size:14px;background:#FFF;}
#pagination .active a:hover{background:#3399CC;color:#FFF;border:1px solid #0364ae;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
#pagination .inactive{color:#CCC;padding:5px 7px 5px 7px;border:1px solid #EEE;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}


 

3. Usage

The function that we are going to use to display the page numbers instead of Next or Previous entries is

This can be used in theme files such as

  • home.php (if exists)
  • index.php
  • archives.php
  • category.php (if exists)

Now everything is complete. If you have any queries regarding this trick use the comment form below. 🙂

Categories
Tips

Best Blogger Hacks Collection – Part 2

Well this my 2 post on the same topic nearly after 6 month in my last post I have coverred all major hacks related to blogger but there better version of hacks now so in this post you get to know about few updated hacks and few new hacks.

Post Summaries WordPress Style

The very popular Read More or Expandable summaries hack almost every blogger uses this hack but this hack is quite irritating especially if your using the version in which you have to divide the post into two parts summary and the rest of it, also this version sometimes works and sometimes does not and its hard to implement on a old blogger since you have to divide each post to apply this hack uniformly.

Before Hack(no thumbnails)

But por Rô Zanchetta @ BloggerShpera has developed a better and best version of this hack which includes automatic summaries+thumbnail of images in your post this hack gives a very professional look to your blog and once you have added this hack to your template it applies to all your post. Here is what am talking about.


After Hack

But the original post is in Portuguese and Google translate doesn’t work well but Aneesh @ Bloggerplugins has written this hack in a much simple way and has kept all its feature you install this hack form here.

ADVERTISEMENT

Related Posts Hack

ADVERTISEMENT

As its name suggests it adds the list of  your previous posts under same tag under your post body this certainly useful as you keep the visitor enagaged in your site.

There are many version of this hack but am very impressed by a version Developed by Gagan because it mixxes with nearly all blogs and has a neat presentation and looks amazingly professional.

Now look at the other hacks and hack developed by Gagan

Gagan’s version

Use this hack

Breadcrumbs for navigation in Blogger

Breadcrumbs make s navigation easy and help the user to move from one Label to another flawlessly, but the term Breadcrumb is itself quite confusing  so here is definition of Breadcrumbs from Wikipeadia.

Breadcrumbs or breadcrumb trail is a navigation aid used in user interfaces. It gives users a way to keep track of their location within programs or documents. The term comes from the trail of breadcrumbs left by Hansel and Gretel in the popular fairytale.

ADVERTISEMENT

As far I remember i saw this hack first developed by Amanda which deals with usual code editing and related stuff but the best about this version is that it will appear in different styles on your different Blog pages.

ADVERTISEMENT

Use this hack

Recent posts Widget with Thumbnails

This widget was developed by Aneesh this looks very attractive and looks professional you can edit the no of words in summary and thubnails support is good but it show images upload via blogger only.

Use this Hack

ADVERTISEMENT

SEO for Blogger Blogs

SEO for me seems an endless topic everyone has its own way to describe it but most important thing we should we remember that Content is the King it does not matter that poorly your blog is optimize for search engines but if written good articles than visitor will sure came back to your Blog, also you need to change your Blogging habits for example post at a particular time, so that readers knew exactly when they will have fresh content.

Also you need add some cosmetic to your posts i means you should write post in attractive manner so it should be visually appealing for this recommend you to read these post.

Also there is a good post by Rajeelkp. Which deals with all SEO hacks available for blogger.

There are also many other hack that will be discussed in future posts.


[Editor Note: This post is by Alok Chaudhari. He blogs at Freewares n Beta about best freeware stuff.

If you like to write for Devils Workshop, please check this. Details about our revenue sharing programs are here.]

Categories
Tips

Top 7 Ways to Optimize Your Blog for Bing; Get Massive Traffic Overnight!

Bing is the most reviewed and discussed software of this year.It has been filled in news before it’s launching itself. Now it is one of the most used search engine and  powerful opponent to even the giant Google. I think I don’t want to tell you that number peoples are using this search engine. Just think if you can get huge traffic from it. Interesting, isn’t it ? But don’t just dream that Bing will simply send visitors to your blog. You have to optimize your blog for Bing,  then only you can get visitors from Bing. Anyway, No one has got that in what criteria Bing is ranking websites. But there are some little little tips we got about Bing. I have listed the TOP 7 – which have been approved by the whole web, in one voice.

1. Keywords In Domain

It’s heard that Bing is giving great importance to the keywords that are present in the domain name itself. So, bear this in mind while buying a new domain.

2. Age of your Domain

ADVERTISEMENT

It’s approved that Bing is having more attraction towards old links. So try to buy an old domain, instead of registering a new one and being marked as a baby.

3. Size of the Content

Bing gives a great importance to pages with huge contents. A post with a 600 words could surely drive you a lot of traffic overnight.

4. Backlinks

ADVERTISEMENT

Just as Google, Bing also use backlinks to measure your blog. Bing also gives a great importance to quality links. A good link could give you great authority than 100 bad links. Also bear in mind that bad links could effect your Bing rankings negatively.

5.  Anchor Text

It seems like that Bing is having an eye on your anchor text too. So, don’t forget to use your killer keywords as your anchor text.

6. Page Title

In this case also, Bing shows similarity to Google. They are giving great importance to the page titles and the keywords in it.

ADVERTISEMENT

7. Internal Links

Rather than counting the number of words, Bing is using the internal links on your site to calculate your keyword density. So don’t forget to give a link when you highlight your keywords.

There are so many other tips too, but these are the most useful and working tips. All these are simple and with these simple changes, you will be getting huge traffic !!! Isn’t it Interesting ?

So, make these changes on your blog, today itself. Enjoy……!!

(Source : Ezinearticles – 3 ways to optimize blog for bing)


[Editor’s Note: This post is submitted by our guest blogger Rajeel KP or ‘Reji’. Rajeel is a teen blogger who writes at Labofweb on stuff related to the Internet, blogging, useful sites, utilities, tech news, blogger templates, etc.

If you, too would like to write for Devils Workshop, please check this. Details about our revenue sharing programs are here.]

Categories
News

More security issues with Google Chrome

Very recently, I had written about Security Problems with Google Chrome and how a FIX had been released to resolve the issue. But it appears that within a span of two weeks, Google Chrome has been updated with two more security patches, to fix a pair of vulnerabilities, one being critical and the other high risk.

Vulnerabilities

  • Critical: An attacker might be able to run code with the privileges of the logged on user.
  • High: An attacker might be able to run arbitrary code within the Google Chrome sandbox.

Silent Updates

ADVERTISEMENT

Google Chrome is released as a silent update, meaning that the browser patches itself without the user’s knowledge.

Google Chrome Security Fixes

CVE-2009-1441: Input validation error in the browser process

A failure to properly validate input from a renderer (tab) process could allow an attacker to crash the browser and possibly run arbitrary code with the privileges of the logged on user. To exploit this vulnerability, an attacker would need to be able to run arbitrary code inside the renderer process.

ADVERTISEMENT

Mitigation: An attacker would need to be able to run arbitrary code in the renderer process.

CVE-2009-1442: Integer overflow in Skia 2D graphics

A failure to check the result of integer multiplication when computing image sizes could allow a specially-crafted image or canvas to cause a tab to crash and it might be possible for an attacker to execute arbitrary code inside the (sandboxed) renderer process.

Mitigation:

  • A victim would need to visit a page under an attacker’s control.
  • Any code that an attacker might be able to run inside the renderer process would be inside the sandbox

(Source: GoogleChromeReleases)

Categories
News

Adobe Security Updates on May 12

Last month, Adobe’s Product Security Incident Response Team (PSIRT) announced potential vulnerability in Adobe Reader 9.1 and 8.1.4 and had urged users on all platforms to disable JavaScript.

Since then, many have been eagerly awaiting Adobe security patches so that the issue can be fixed. Adobe has set a May 12 date for the delivery of patches to fix the vulnerability in its Adobe Reader and Acrobat software products.

PSIRT says:

“We are in the process of fixing the issue, and expect to make available product updates for the relevant supported Adobe Reader and Acrobat versions and platforms by May 12th, 2009.

ADVERTISEMENT

Additionally, we have confirmed the second vulnerability (CVE-2009-1493) for Adobe Reader for Unix. This issue will be resolved in the upcoming Adobe Reader for Unix updates. Currently, we have not been able to reproduce an exploitable scenario for Windows and Macintosh, but we will continue to investigate.”

Adobe Upcoming Updates:

  1. Window updates for Adobe Reader versions 9.X, 8.X, and 7.X
  2. Window updates for Acrobat versions 9.X, 8.X, and 7.X
  3. Macintosh updates for Adobe Reader versions 9.X and 8.X
  4. Macintosh updates for Acrobat versions 9.X and 8.X
  5. Adobe Reader for Unix versions 9.X and 8.X.

In the meantime, continue to keep your JavaScript in Adobe PDF Reader disabled. To know how you could do that, read my earlier post: Disable JavaScript in Adobe PDF Reader!

If you still think Adobe Reader could be a “risk” to your machine, then do consider using an alternate program.

(Source: Adobe Blog)

Categories
News

ALERT! Malicious Swine Flu Emails on the Rise

Data thieves and spammers want to make the most of every situation. After the sudden and unfortunate outbreak of Swine Flu, looks like the cybercriminals want to capitalize on this situation too.

Since the outbreak of the flu, online data stats across the globe suggests that people have been hitting the internet in frenzy looking for Swine Flu related information.

Capitalizing on this, the cybercriminals have been sending infected files to the masses via emails, keying off curiosity about Swine Flu.

ADVERTISEMENT

One such email has a PDF attachment titled: Swine influenza frequently asked questions.pdf.

Clicking on the PDF runs a data stealing program on your computer. If you see this, delete it from your inbox.

There are many more such emails doing their rounds. These messages (related to Swine Flu) try to get you to click on tainted web links. Instead, you end up installing various malicious programs on your computer. Many times, you even get directed to websites selling fake pharmaceutical drugs.

Symantec and Cisco Ironport recommend immediate deletion of email messages with these subject lines:

ADVERTISEMENT
  • Swine flu worldwide
  • Swine flu in the USA
  • US swine flue fears
  • First US Sine flue victims
  • Swine flu in Hollywood
  • Salma Hayek caught swine flu
  • Madonna caught swine flu
  • US swine flu statistics
  • NY victims of swine flu
  • First US swine flu victims
  • Will swine flu attack USA?
  • US swine flu fear

Symantec’s Mayur Kulkarni writes:

There is another spam campaign underway that is also using headlines related to the swine flu outbreak, but the messages don’t contain any URLs or attachments. The intention of this type of campaign is to spread fear, uncertainty, and doubt (FUD) among email users. Some of the headlines used in this particular type of email spam have been hoisted from various news agencies, and examples are listed below:

  • Mexico on edge as reports of swine flu cases climb
  • UK monitoring swine flu outbreak
  • UK probes ’17 swine flu reports’
  • Global panic as swine flu spreads to Europe
  • US declares emergency as Mexico flu death toll rises
  • Probable Mexico swine flu death toll – 103: minister
  • Swine flu case confirmed in Spain
  • Are you worried about flu outbreak?
  • World moves to contain flu spread
  • U.S. tries to get a handle on flu outbreak
  • World ‘well prepared’ for virus
  • World flu epidemic fear rises, Mexicans take refuge
  • Twenty swine flu cases confirmed in U.S.
  • Mexico flu sparks worldwide fear
  • Suspected Mexico flu toll hits 81
  • Mexico flu ‘a potential pandemic’
  • 81 feared dead from swine flu in Mexico
  • Swine flu epidemic fear grows, world on alert
  • U.S. acts swiftly to contain swine flu outbreak
  • Family alert to swine flu illness

Whether Swine Flu manages to reach all corners across the globe or not, but its internet versions definitely seems to be on the mission to spread a different kind of “infection” altogether! Watch out! Don’t let it reach you.

(Source: USAToday | Symantec)

Categories
News

Beware! Phishing scam on Facebook

Has anyone faced a hoax issue on Facebook yet? If you have a Facebook account, then be a little careful. There has been a major spur of phishing attacks on Facebook to steal usernames and passwords and spam your friends.

How is it being done?

Facebook’s mail system is being used by the attackers to send messages to the users, enticing them to go to – fbaction.net – a site that duplicates Facebook’s log-in screen.

The word has been around that Facebook has blocked this URL and this has hopefully brought an end to the entire nuisance.

Better safe than sorry…

It is still very important that we REMEMBER NOT TO LOG into a page that claims to be “Facebook” unless the URL is www.facebook.com. Wouldn’t hurt being just a little extra-cautious!

(Source: allFacebook)

Categories
News

Security Problems with Google Chrome?

There was a security threat with Google’s web browser – Google Chrome. According to the Google Chrome Team, there was an error in handling URLs with a chromehtml: protocol. This allowed the attacker to run scripts of his choice on any page or enumerate files on the local disk under certain conditions.

Because of this problem, the attacker could endanger any user who browsed a malicious site using Internet Explorer and had Google Chrome installed.

As per IBM Rational Application Security Insider, this allowed a dangerous combination of new security vulnerabilities letting a malicious attacker to bypass the Same Origin Policy restrictions for any site using the victim’s Google Chrome.

ADVERTISEMENT

The dangerous impact:

  1. Cross-Site Scripting attack where the attacker could steal cookies, save form filler data, modify user-browsing experience and facilitate phishing attacks.
  2. Leaking of information: from the victim’s files and directories on the local file-system.

But, the good news is that a FIX has been released: Version 1.0.154.59 of Chrome and hopefully, all the security issues revolving around Google Chrome are under control now.

Link: Fix for Chrome

(Source: GoogleChromeReleases | IBM watchfire)

Categories
News

Orkut’s “Shiv-Sena Hate Community” Busted!

What happened to the freedom of speech and expression, I wonder? Imagine running a community on Orkut, and being held accountable for every message posted. This is exactly what happened to Ajith D, a 19 year old computer student and an Orkut account holder, who apparently created a “Shiv Sena hate community” on Orkut. Mumbai cyber crime tracked him down and initiated criminal proceedings against him. Not just that, the site is being constantly supervised by the police after the Sena violently protested against Orkut for carrying anti-party remarks.

Ajith has denied posting any death threats against Sena’s Chief Bal Thackeray, however, has admitted on creating the anti-Shiv Sena online group.

Try running a simple search on Orkut, and you’d find hundreds of such “hate communities” online – “I hate Ekta Kapoor”, I hate George W. Bush” and so on, where people post all kinds of comments, share all kinds of personal views. I’m sure many Orkut users (and others) have already deleted their online communities after this incident blew up.

Share your thoughts on what you think about this case? Also, do you think that your online freedom of expression is being threatened?

After this incident, I personally feel very uncomfortable creating a community online. Being held accountable in the court of law, for statements made or opinions shared within the community, in my books, is a little too excessive!

(Source: The Telegraph)

Categories
News

Softpedia and Download.com are suffering from virus, spywares, trojans, etc

Sometime back Deepak posted about McAfee SiteAdvisor. It scans a website for any kind of threat issues to users.

McAfee SiteAdvisor scans your site to the deepest level. It scans all your email areas, download files, online affiliations and annoyances from your site. You can not only scan your website or blog, you can scan any website (even if you don’t own it) on this platform.

Now comes the interesting, rather shocking part!

McAfee confirms that top download sites like download.com and softpedia.com are having threat issues with their softwares. McAfee reported that these sites are having adwares, trojans in their download files.

Virus scan result of download.com

It clearly says that not all the files from this largest software downloading site are safe.

Below is scan result of softpedia.com

Softpedia is also suffering from spyware, adware and trojan threats. To defend their website, one of their staffs confirmed that they can’t control software developers or firms who update their software versions by adding new installation files without any information to Softpedia staffs. Well one can understand this problem, but shouldn’t they use some script to track these software upgrades? They should think about this.

Now you can integrate McAfee Site Advisor utility with your browsers also. This utility will warn you about sites with potential threat issues in real time. Start using Site Advisor to keep your website and computer clean.

Related: 5 Simple Tips To Fight Against Phishing Attack


[Editors Note: This post is by Bapun who blogs at Solidblogger about technology.

If you too like to write for Devils Workshop, please check this. Details about our revenue sharing programs are here.]