Recently, I’ve created two genuine WordPress themes from a CSS design.
If I knew well the plug-ins system, themes were a discovery.
And, hey, the theme system is very great and flexible.
Look for example K2 on www.getk2.com and its AJAX capabilities.
I’m planning to create a K2 design and migrate my blog to WordPress. Oh, and I’m going to develop and release a plug-in to implement languages categories, so I can continue to blog in french (mainly personal entries) and english (mainly technical articles).
In the while, here some functions I’ve just coded 😉
Dereckson’s WordPress functions
Functions I’ve written for these themes.
-
/* * * * * * * * * * * * * * *
-
* Filter 9 Theme functions *
-
* * * * * * * * * * * * * */
-
-
//Prints alternatively textpost1 and textpost2
-
function get_textpost_class() {
-
return ($n++ % 2 == 0) ? "textpost1" : "textpost2";
-
}
-
-
//Prints image
-
function the_image () {
-
global $id;
-
}
-
-
//Returns true if the post is an image post
-
function is_imagepost() {
-
global $id;
-
return get_post_meta($id, "image", "true");
-
}
-
-
//Prints archive title
-
function get_archive_title () {
-
if (is_category()) {
-
} elseif (is_day()) {
-
} elseif (is_month()) {
-
} elseif (is_year()) {
-
} elseif (is_search()) {
-
echo ‘Search results’;
-
} elseif (is_author()) {
-
echo ‘Author archive’;
-
echo ‘Blog archives’;
-
} else {
-
echo ‘Archive 42’;
-
}
-
}
-
-
/* * * * * * * * * * * * *
-
* Curat Theme functions *
-
* * * * * * * * * * * * */
-
-
function wp_get_numeral_archives($args = ”) {
-
//Prints archives by Numărul
-
//Developed for curat | murdar by Sébastien Santoro aka Dereckson, W3 LIFT
-
-
-
$r = &$args;
-
else
-
-
$defaults = array(‘limit’ => ”, ‘format’ => ‘html’, ‘before’ => ”, ‘after’ => ”, ‘show_post_count’ => false);
-
-
if ( ” != $limit ) {
-
$limit = (int) $limit;
-
$limit = ‘ LIMIT ‘.$limit;
-
}
-
-
-
//Weekly archives
-
$start_of_week = get_option(‘start_of_week’);
-
$arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS
week
, YEAR(post_date) AS yr, DATE_FORMAT(post_date, ‘%Y-%m-%d’) AS yyyymmdd, count(ID) as posts FROM $wpdb->posts WHERE post_type = ‘post’ AND post_status = ‘publish’ GROUP BY WEEK(post_date, $start_of_week), YEAR(post_date) ORDER BY post_date DESC" . $limit); -
$arc_w_last = ”;
-
$afterafter = $after;
-
if ( $arcresults ) {
-
foreach ( $arcresults as $arcresult ) {
-
if ( $arcresult->week != $arc_w_last ) {
-
$arc_year = $arcresult->yr;
-
$arc_w_last = $arcresult->week;
-
$arc_week = get_weekstartend($arcresult->yyyymmdd, get_option(‘start_of_week’));
-
$arc_week_start = date_i18n($archive_week_start_date_format, $arc_week[‘start’]);
-
$arc_week_end = date_i18n($archive_week_end_date_format, $arc_week[‘end’]);
-
$url = sprintf(‘%1$s/%2$s%3$sm%4$s%5$s%6$sw%7$s%8$d’, get_option(‘home’), ”, ‘?’, ‘=’, $arc_year, ‘&’, ‘=’, $arcresult->week);
-
$numarul = ($arc_year – 2005) * 52 – 5 + $arc_w_last;
-
$text = "Numărul $numarul";
-
if ($show_post_count)
-
$after = ‘ (‘.$arcresult->posts.‘)’.$afterafter;
-
-
}
-
}
-
}
-
}
Parsed in 0.413 seconds | © 2007, Sébastien Santoro aka Dereckson, some rights reserved.
Released under BSD License, help wp_get_numeral_archives released in GPL, as based on existing WordPress function.
Released under BSD License, help wp_get_numeral_archives released in GPL, as based on existing WordPress function.