Category Archives: Wordpress

How to change number of posts for only front(index) page?

Open your theme/index.php file.

Or if you have loop-index.php file, then open it. (because if you using the other index theme later, then it will not effect to new theme.)

index.php

after

  get_header();

, put

  query_posts('posts_per_page=15');

like this :

get_header();

query_posts('posts_per_page=15');

If you open your loop-index.php file,

put this

  query_posts('posts_per_page=15');

on top of file in php code.

Good luck~! ^^

Posted in Wordpress | Tagged , , | 4 Comments

Index page theme

I just make my index page theme. ^^

I share it~!

download

download the file and unzip, then you can see the loop-index.php file

put this file in yourtheme/ folder

* If you have already loop-index.php file, please backup your original file first!

Thanks

P.S : I use juery and jquery-masonry plugin!

Thanks David and jquery~!

http://desandro.com/resources/jquery-masonry/

Posted in Wordpress, Works | Tagged , , | Leave a comment

Let’s play with WP-tempates

I want to create custom gallery list templates.

Firstly, I add a new ‘Gallery’ category and post a image in the category.

then just I check the list view.

OMG!

I didn’t do anything! but it look different from the other list!… Hum.. let’s see the templates file in.

your theme/loop.php

line 60 : <?php if ( in_category( _x(‘gallery’, ‘gallery category slug’, ‘twentyten’) ) ) : ?>

Oh ho! Smart WP filter category name! cool! now it much easier to develop gallery list temlates!

ok then, I change the ‘<?php if ( in_category( _x(‘gallery’, ‘gallery category slug’, ‘twentyten’) ) ) : ?>‘ to ‘<?php if ( in_category( _x(‘gallery’, ‘gallery category slug’, ‘twentyten’) ) ) : ?> ioi
(I just put the ‘ioi’ end of the line)

and see the list view,

ok, Now we can simply modify the view source. BUT, How about index page?

Is it using same loop.php?

Oh no, it effect to index list too. It should be different, I just want to custom the tempate for gallery category list. (I mean the view after click the Gallery category button)

Hum.. ok then let’s look at how to load template file?

In category.php, it call the template file like this,

get_template_part( 'loop', 'category' );

ok, let’s look for get_tempalte_part function.

wp-includes/general-templates.php, line #119

function get_template_part( $slug, $name = null ) {
do_action( "get_template_part_{$slug}", $slug, $name );

$templates = array();
if ( isset($name) )
$templates[] = "{$slug}-{$name}.php"; 

$templates[] = "{$slug}.php";

locate_template($templates, true, false);
}

Look at line #6,
Oh, it’s looking for the loop-category.php file //because I pass the parameter as ‘loop’,’category’

Great!, then just create a file loop-category.php and modify the source for list view.

Bonus, find right path,

Main(index) : index.php -> loop.php

Category : category.php -> loop.php

View(Detail) Page : sigle.php

I might different depend on your setting ^^;

…….

good night ~^0^

Posted in Wordpress | Tagged , , , , | 3 Comments

Installed Syntax Highlighter plugin ^^

echo "Hello world";

Good ^^

It was a little hard to find how to use,

Usage :

<pre class=”brush:[php]”>
echo “Hello world”;
</pre>
Brush Types ::
  • Bash/shell
  • C#
  • C++
  • CSS
  • Delphi
  • Diff
  • Groovy
  • JavaScript
  • Java
  • Perl
  • PHP
  • Plain Text
  • Python
  • Ruby
  • Scala
  • SQL
  • Visual Basic
  • XML
Posted in Wordpress | Tagged , | 7 Comments

WordPress get post ID

<?php the_ID(); ?> 하면 바로 찍어버리는데,

get_the_ID() 를 쓰면 값을 return 해준다.

Posted in Wordpress | Tagged , | 1 Comment

WordPress DB Diagram

http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png

Posted in Wordpress | Tagged , | 5 Comments

WordPress Structure

http://bluebirdservices.info/blog/2009/03/29/the-wordpress-structure/

Posted in Wordpress | 2 Comments

WordPress 특정 카테고리 post 가져오기

특정 카테고리의 post 한개만 다른 사이트에서 가져다 써야할 일이 생겼다. (latest news)

DB 스키마안보고 대충 때려 맞춰볼다 실패 하여..^^

스키마부분을 보니 (스키마 : http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png)

wp_posts -> wp_term_relationships -> wp_term_taxonomy 이렇게 related 되어 있었다.

Admin의 카테고리 수정페이지에 보면 ~~~&tag_ID=5 와 같은 url를 확인할수 있는데

저 tag_ID가 바로 term_taxonomy_id 값이다.

wp_term_relationships 테이블의 object_id 값에는 wp_posts의 ID 값이 들어 있을테니,

특정 카테고리의 POSTs를 가져오는 쿼리는 다음과 같겠다.

SELECT *
FROM `wp_posts`
WHERE `ID`
IN (

SELECT object_id
FROM `wp_term_relationships`
WHERE `term_taxonomy_id` =5

)
ORDER BY `ID` DESC

http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png
Posted in Wordpress | 1 Comment