barmin
Forum Replies Created
-
Forum: Plugins
In reply to: Any new plugin requests?I have a quite simple request! you can check it here. I tried to make it as clear and simple as posible:
https://www.ads-software.com/support/topic/197661?replies=1
Thank you!
Forum: Plugins
In reply to: News TickerI did it by using the <marquee> tag, and writing a loop in it.
Forum: Fixing WordPress
In reply to: Pick only posts within cat1 AND cat2No ideas?
Forum: Fixing WordPress
In reply to: Editor not saving tablesAs I told before… Even when I did it pasting the HTML code in the HTML code editor, it wouldn’t work.
Anyway, I managed it out, by coping the table from Excel to Word, and from there to the WYSIWYG editor, and it worked fine. Weird thing.
Forum: Fixing WordPress
In reply to: Selective next/prev_post_link – Coder highly needed!I’ve tried some variations of the above hack, but none worked out…
Is someone out there who could help me with coding, please?
Forum: Fixing WordPress
In reply to: Selective next/prev_post_link – Coder highly needed!Asking for assistance. I did the following hack:
Added the parameter “$for_category” to previous_post_link template tag, and to the casting of get_previous_post:
(don’t know how to use markup to highlight)
function previous_post_link($format=’« %link’, $link=’%title’, $in_same_cat = false, $excluded_categories = ”, $for_category) {
if ( is_attachment() )
$post = & get_post($GLOBALS[‘post’]->post_parent);
else
$post = get_previous_post($in_same_cat, $excluded_categories, $for_category);if ( !$post )
return;$title = apply_filters(‘the_title’, $post->post_title, $post);
$string = ‘ID).'”>’;
$link = str_replace(‘%title’, $title, $link);
$link = $pre . $string . $link . ‘‘;$format = str_replace(‘%link’, $link, $format);
echo $format;
}Then, added the same parameter to get_previous_post function, but defaulting it to what comes by default for $cat_array, within the if ($in_name_cat): ‘get_the_category($post->ID)’.
Then, replaced this original string with the parameter, so that the 5th value entered when casting prev_post_link, becomes the $cat_array:
function get_previous_post($in_same_cat = false, $excluded_categories = ”, $for_category = ‘get_the_category($post->ID)’) {
global $post, $wpdb;if( !is_single() || is_attachment() )
return null;$current_post_date = $post->post_date;
$join = ”;
if ( $in_same_cat ) {
$join = ” INNER JOIN $wpdb->post2cat ON $wpdb->posts.ID= $wpdb->post2cat.post_id “;
$cat_array = $for_category;
$join .= ‘ AND (category_id = ‘ . intval($cat_array[0]->cat_ID);
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
$join .= ‘ OR category_id = ‘ . intval($cat_array[$i]->cat_ID);
}
$join .= ‘)’;
}$sql_exclude_cats = ”;
if (!empty($excluded_categories)) {
### ronr hack ###}
return @$wpdb->get_row(“SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < ‘$current_post_date’ AND post_status = ‘publish’ $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT 1”);
}When I run the site with this hack, the page turns white whenever I cast it. Any suggestions?
Forum: Plugins
In reply to: Selective next/prev_post_link – Coder highly needed!I got it conceptualized. It should be like this:
function next_post_by_cat($cat_id = ”) {
> get.category($cat).posts
> get.current.post.date
> select.next.post.by.dateoutput
}
Easy, ain’t it?
Forum: Fixing WordPress
In reply to: Pages are being categorized!Duh… didn’t think about it. It would have worked too.
Otto42, could you please help me with the other topic that’s bugging me?
Forum: Fixing WordPress
In reply to: Pages are being categorized!Worked fine. DB hack.
Now I need some help with se 2nd part of this mess:
Forum: Fixing WordPress
In reply to: Specify category for next/prev_post_linkI didn’t find anything about restricting it to some category. The in_same_cat parameter doesn’t work for me.
I’ve got 3 categories: “front page”, “news” and “health”. The index only displays the posts of the “front page” category. But both posts of “news” or “health” could be also categorized as “front page” (depending on the relevance, but it ain’t important).
Therefore, if I’m reading a frontpage-news post, it could jump to a frontpage-health, because they ARE in the same category. That’s why I need it to be restricted to a category by using the IF and the category-forced link tag.
Forum: Fixing WordPress
In reply to: Pages are being categorized!So, I should create a new category “Pages”, and assing the pages to it, by editing the DataBase… It should work, doesn’t it?
BTW, I’m using WP 2.0, not 2.1
Forum: Fixing WordPress
In reply to: [Help] Specific posts on index?Ah, BTW, sorry about the Client thing… It’s embarrasing…
Forum: Fixing WordPress
In reply to: [Help] Specific posts on index?I used already a solution like that, by hacking The Loop to show only posts from the “Front” category. But since there are posts from the other two categories sharing this “front” one, it all gets messy when it comes to navigation.
From the “health-front” post, it jumps to the “news-front” post, instead to the “health” as it should be. And if I use the “exclude from category” value in the prev/next_post_link tag, it would just skip all of the posts in the “front” category, hiding them from the navigation.
That’s why I need it to be done the other way.
Forum: Fixing WordPress
In reply to: [Help] Specific posts on index?Excuse me for bringing this up again, but I really need help on this, since it is for a client.
Forum: Fixing WordPress
In reply to: Restrict Prev/Next_Post_Link tag to categoriesExcuse me for bringing this up again, but I really need help on this, since it is for a client.