Plugin Directory

Changeset 192345


Ignore:
Timestamp:
01/10/2010 08:43:34 PM (16 years ago)
Author:
Warll
Message:

fixed pulling form tags

Location:
afterread/trunk/suggestions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • afterread/trunk/suggestions/dynamic_prior_next_tag_default.php

    r192157 r192345  
    99
    1010foreach ($afterRead_raw_posttags as $afterRead_raw_posttags_temp){
    11     $afterRead_posttags[]= $afterRead_raw_posttags_temp->term_taxonomy_id;
     11    $afterRead_posttags[]= $afterRead_raw_posttags_temp->term_id;
    1212}
    1313$afterRead_posts_by_tags = get_objects_in_term($afterRead_posttags,"post_tag");
     
    2121$afterRead_time_of_post = strtotime($post->post_date_gmt);
    2222
    23 for ($i = 0, $size = sizeof($afterRead_posts); $i < $size; $i++){
     23// foreach ($afterRead_posts as $afterRead_postsd) {
     24// echo $afterRead_postsd-> post_id.' : '.$afterRead_postsd-> time;
     25// echo '<br />';
     26// }
     27
     28$afterRead_sorting_newer-> time = 99999999999999999;
     29for ( $i = sizeof($afterRead_posts) -1; $i >= 0; $i--){
    2430    if ($afterRead_time_of_post < $afterRead_posts[$i]-> time) {
    25         $afterRead_next_post = $afterRead_posts[$i]-> post_id;
    26         $s = $i + 2;
    27         $afterRead_previous_post = $afterRead_posts[$s]-> post_id;
    28         break 1;
     31        if ($afterRead_sorting_newer-> time > $afterRead_posts[$i]-> time) {
     32        $afterRead_sorting_newer = $afterRead_posts[$i];
     33        }
     34        //$afterRead_next_post = $afterRead_posts[$i]-> post_id;
    2935    }
    3036}
     37$afterRead_next_post = $afterRead_sorting_newer-> post_id;
     38
     39$afterRead_sorting_older-> time  = 0;
     40for ($i = 0, $size = sizeof($afterRead_posts); $i < $size; $i++){
     41    if ($afterRead_time_of_post > $afterRead_posts[$i]-> time) {
     42        if ($afterRead_sorting_older-> time < $afterRead_posts[$i]-> time) {
     43        $afterRead_sorting_older = $afterRead_posts[$i];
     44        }
     45        //$afterRead_next_post = $afterRead_posts[$i]-> post_id;
     46    }
     47}
     48$afterRead_previous_post = $afterRead_sorting_older-> post_id;
     49
     50
    3151if ($afterRead_previous_post) {
    32 $afterRead_previous_post = get_post($afterRead_previous_post);
     52    $afterRead_previous_post = get_post($afterRead_previous_post);
     53    if ($afterRead_previous_post->post_status !== publish) {
     54        $afterRead_previous_post="";
     55    }
    3356}
    3457if ($afterRead_next_post) {
    35 $afterRead_next_post = get_post($afterRead_next_post);
     58    $afterRead_next_post = get_post($afterRead_next_post);
     59    if ($afterRead_next_post->post_status !== publish) {
     60            $afterRead_next_post="";
     61        }
    3662}
    3763// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  • afterread/trunk/suggestions/dynamic_prior_next_tag_styled_1.php

    r192157 r192345  
    99
    1010foreach ($afterRead_raw_posttags as $afterRead_raw_posttags_temp){
    11     $afterRead_posttags[]= $afterRead_raw_posttags_temp->term_taxonomy_id;
     11    $afterRead_posttags[]= $afterRead_raw_posttags_temp->term_id;
    1212}
    1313$afterRead_posts_by_tags = get_objects_in_term($afterRead_posttags,"post_tag");
     
    2121$afterRead_time_of_post = strtotime($post->post_date_gmt);
    2222
    23 for ($i = 0, $size = sizeof($afterRead_posts); $i < $size; $i++){
     23// foreach ($afterRead_posts as $afterRead_postsd) {
     24// echo $afterRead_postsd-> post_id.' : '.$afterRead_postsd-> time;
     25// echo '<br />';
     26// }
     27
     28$afterRead_sorting_newer-> time = 99999999999999999;
     29for ( $i = sizeof($afterRead_posts) -1; $i >= 0; $i--){
    2430    if ($afterRead_time_of_post < $afterRead_posts[$i]-> time) {
    25         $afterRead_next_post = $afterRead_posts[$i]-> post_id;
    26         $s = $i + 2;
    27         $afterRead_previous_post = $afterRead_posts[$s]-> post_id;
    28         break 1;
     31        if ($afterRead_sorting_newer-> time > $afterRead_posts[$i]-> time) {
     32        $afterRead_sorting_newer = $afterRead_posts[$i];
     33        }
     34        //$afterRead_next_post = $afterRead_posts[$i]-> post_id;
    2935    }
    3036}
     37$afterRead_next_post = $afterRead_sorting_newer-> post_id;
     38
     39$afterRead_sorting_older-> time  = 0;
     40for ($i = 0, $size = sizeof($afterRead_posts); $i < $size; $i++){
     41    if ($afterRead_time_of_post > $afterRead_posts[$i]-> time) {
     42        if ($afterRead_sorting_older-> time < $afterRead_posts[$i]-> time) {
     43        $afterRead_sorting_older = $afterRead_posts[$i];
     44        }
     45        //$afterRead_next_post = $afterRead_posts[$i]-> post_id;
     46    }
     47}
     48$afterRead_previous_post = $afterRead_sorting_older-> post_id;
     49
     50
    3151if ($afterRead_previous_post) {
    32 $afterRead_previous_post = get_post($afterRead_previous_post);
     52    $afterRead_previous_post = get_post($afterRead_previous_post);
     53    if ($afterRead_previous_post->post_status !== publish) {
     54        $afterRead_previous_post="";
     55    }
    3356}
    3457if ($afterRead_next_post) {
    35 $afterRead_next_post = get_post($afterRead_next_post);
     58    $afterRead_next_post = get_post($afterRead_next_post);
     59    if ($afterRead_next_post->post_status !== publish) {
     60            $afterRead_next_post="";
     61        }
    3662}
     63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     64//Beyond this line is only styling, should this suggestion need updating all you need to do is copy the above and replace the similar code in the styled suggestions
     65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    3766
    3867if ($afterRead_previous_post) {
  • afterread/trunk/suggestions/dynamic_prior_next_tag_styled_2.php

    r192157 r192345  
    99
    1010foreach ($afterRead_raw_posttags as $afterRead_raw_posttags_temp){
    11     $afterRead_posttags[]= $afterRead_raw_posttags_temp->term_taxonomy_id;
     11    $afterRead_posttags[]= $afterRead_raw_posttags_temp->term_id;
    1212}
    1313$afterRead_posts_by_tags = get_objects_in_term($afterRead_posttags,"post_tag");
     
    2121$afterRead_time_of_post = strtotime($post->post_date_gmt);
    2222
    23 for ($i = 0, $size = sizeof($afterRead_posts); $i < $size; $i++){
     23// foreach ($afterRead_posts as $afterRead_postsd) {
     24// echo $afterRead_postsd-> post_id.' : '.$afterRead_postsd-> time;
     25// echo '<br />';
     26// }
     27
     28$afterRead_sorting_newer-> time = 99999999999999999;
     29for ( $i = sizeof($afterRead_posts) -1; $i >= 0; $i--){
    2430    if ($afterRead_time_of_post < $afterRead_posts[$i]-> time) {
    25         $afterRead_next_post = $afterRead_posts[$i]-> post_id;
    26         $s = $i + 2;
    27         $afterRead_previous_post = $afterRead_posts[$s]-> post_id;
    28         break 1;
     31        if ($afterRead_sorting_newer-> time > $afterRead_posts[$i]-> time) {
     32        $afterRead_sorting_newer = $afterRead_posts[$i];
     33        }
     34        //$afterRead_next_post = $afterRead_posts[$i]-> post_id;
    2935    }
    3036}
     37$afterRead_next_post = $afterRead_sorting_newer-> post_id;
     38
     39$afterRead_sorting_older-> time  = 0;
     40for ($i = 0, $size = sizeof($afterRead_posts); $i < $size; $i++){
     41    if ($afterRead_time_of_post > $afterRead_posts[$i]-> time) {
     42        if ($afterRead_sorting_older-> time < $afterRead_posts[$i]-> time) {
     43        $afterRead_sorting_older = $afterRead_posts[$i];
     44        }
     45        //$afterRead_next_post = $afterRead_posts[$i]-> post_id;
     46    }
     47}
     48$afterRead_previous_post = $afterRead_sorting_older-> post_id;
     49
     50
    3151if ($afterRead_previous_post) {
    32 $afterRead_previous_post = get_post($afterRead_previous_post);
     52    $afterRead_previous_post = get_post($afterRead_previous_post);
     53    if ($afterRead_previous_post->post_status !== publish) {
     54        $afterRead_previous_post="";
     55    }
    3356}
    3457if ($afterRead_next_post) {
    35 $afterRead_next_post = get_post($afterRead_next_post);
     58    $afterRead_next_post = get_post($afterRead_next_post);
     59    if ($afterRead_next_post->post_status !== publish) {
     60            $afterRead_next_post="";
     61        }
    3662}
     63// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     64//Beyond this line is only styling, should this suggestion need updating all you need to do is copy the above and replace the similar code in the styled suggestions
     65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     66
    3767
    3868if ($afterRead_previous_post) {
Note: See TracChangeset for help on using the changeset viewer.