17
WP Hacks WP Hacks When a “Hacker” Becomes a When a “Hacker” Becomes a Hero Hero by Mohamad Agus Sya’ban Seri Menjadi Pujangga Wordpress Seri Menjadi Pujangga Wordpress Bagian 3 Bagian 3

Wordpress Hacks: When a "Hacker" Becomes a Hero

Embed Size (px)

DESCRIPTION

If you need to build a wordpress site which does not only have a default setting for both looks or functionality, then WP-Hacks is the answer!

Citation preview

Page 1: Wordpress Hacks: When a "Hacker" Becomes a Hero

WP HacksWP HacksWhen a “Hacker” Becomes a HeroWhen a “Hacker” Becomes a Hero

by Mohamad Agus Sya’ban

Seri Menjadi Pujangga Wordpress Bagian 3Seri Menjadi Pujangga Wordpress Bagian 3

Page 2: Wordpress Hacks: When a "Hacker" Becomes a Hero

Wordpress EnrichmentWordpress Enrichment

WP Themes

WP Plugins

WP Hacks

http://ericstoller.com/

Page 3: Wordpress Hacks: When a "Hacker" Becomes a Hero

Grand TheoryGrand Theory

Hacking (English verb to hack,

Singular noun a hack) refers to

the re-configuring or

re-programming of a system to

function in ways not facilitated

by the owner, administrator, or

designer. http://en.wikipedia.org/wiki/Hack_%28technology%29

http://sxc.hu

Page 4: Wordpress Hacks: When a "Hacker" Becomes a Hero

WTH is WP-Hacks?WTH is WP-Hacks?

If you need to build a

wordpress site which

does not only have a

default setting for both

looks or functionality ,

then WP-Hacks is the

answer!

Page 5: Wordpress Hacks: When a "Hacker" Becomes a Hero

WP-HacksWP-Hacks

In very early versions of WordPress, the only way to modify

the behavior of WordPress was through a "hack", i.e. by

modifying the core files of WordPress.

http://www.blogohblog.com

Note:Since at least version 2.8, my-hacks.php file is not supported any longer.

Page 6: Wordpress Hacks: When a "Hacker" Becomes a Hero

How can I do the hacks?How can I do the hacks?

• Modifying the wordpress’ core files

• Using function reference (http://codex.wordpress.org/Function_Reference)

• Adding scripts made by wordpress developers into functions.php file

http://oldblog.1choice4yourstore.com/

Page 7: Wordpress Hacks: When a "Hacker" Becomes a Hero

DemoDemo

No photos = hoax

in this case:

So, let’s get it on!

No demos = hoax!

Page 8: Wordpress Hacks: When a "Hacker" Becomes a Hero

Demo 1: Demo 1: Modifying The Wordpress’ Core Files

How to change some html codes on my search form?

Page 9: Wordpress Hacks: When a "Hacker" Becomes a Hero

It’s just a piece of cake!

If you don't have searchform.php in your

Theme, WordPress will render its built-in

search form. If you do have it in your

Theme, it will be used instead.

Page 10: Wordpress Hacks: When a "Hacker" Becomes a Hero

Demo 2: Demo 2: Using Function Reference

How to show some certain elements only if any single post being displayed?

Page 11: Wordpress Hacks: When a "Hacker" Becomes a Hero

Simply put this conditional tag right before stuff you want to show:

is_single(); // When any single Post page is being displayed.

is_single('17'); // When Post 17 (ID) is being displayed.

is_single('Irish Stew'); // When the Post with post_title of "Irish Stew" is being

displayed.

is_single('beef-stew'); // When the Post with post_name (slug) of "beef-stew" is

being displayed.

is_single(array(17,'beef-stew','Irish Stew')); // Returns true when the single post being displayed is either post ID 17, or the post_name is "beef-stew", or the post_title is "Irish Stew".

Page 12: Wordpress Hacks: When a "Hacker" Becomes a Hero

Demo 3 Demo 3 Using functions.phpUsing functions.php

How to show my latest tweets without using plugins?

Page 13: Wordpress Hacks: When a "Hacker" Becomes a Hero

Paste the below in your functions.php file:

function wp_echoTwitter($username){ include_once(ABSPATH.WPINC.'/rss.php'); $tweet = fetch_rss("http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1"); echo $tweet->items[0]['atom_content']; }

Page 14: Wordpress Hacks: When a "Hacker" Becomes a Hero

Now just paste the following in your theme file where you want your Twitter post to appear:

<?php wp_echoTwitter(‘abanesta’); ?>

Obviously replace my username with yours. Now you’re done! Style it however you like with HTML and CSS.

http://www.johnkolbert.com/wordpress/show-your-latest-tweet-in-5-lines-of-code/

Page 15: Wordpress Hacks: When a "Hacker" Becomes a Hero
Page 16: Wordpress Hacks: When a "Hacker" Becomes a Hero

Hacks are not officially supported by

WordPress. Use at your own risk.

Page 17: Wordpress Hacks: When a "Hacker" Becomes a Hero