Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter wpnewbie80

    (@wpnewbie80)

    thanks. I was kinda leaving that as a last resort though as it is a workaround rather than a solution to the original cause of the problem. It would require the eventual editor of the site (not me) to update the file each time they need to upgrade to a newer version of WordPress.

    I really don’t understand what might be the cause though as it doesn’t seem to effect the majority.

    I have exactly the same problem but changing the error messages to something long did not work. I’m completely stuck 🙁

    Thread Starter wpnewbie80

    (@wpnewbie80)

    sorry to bump, but has anyone got any idea how I can solve this?

    Thread Starter wpnewbie80

    (@wpnewbie80)

    so sorry, I forgot to echo get_permalink

    Thread Starter wpnewbie80

    (@wpnewbie80)

    I have come up with this..it seems to work but I’m not sure if its luck or judgement! the function came from pointlessjon’s post

    code is outside the main loop

    $tempQuery = $wp_query;
    
        $currentId = $post->ID;
    	$catToUse = "";
    
    	   function post_child_of_cat($child_post_id, $parent_cat_id){
    		$cat_array = wp_get_post_categories($child_post_id);
    		   foreach ($cat_array as $category){
    			if (cat_is_ancestor_of((int)$parent_cat_id, (int)$category)){
    			    global $catToUse;
                                $catToUse = $category;
          			    return true;
    			 }
    		     }
    		     return false;
    		}
    
            if ( ( $isAguide=in_category('16') ) || ( $needsAguide=post_child_of_cat($post->ID, 6) ) ){
    
    		 if($needsAguide == true){
                     //the post is from a subject category and it needs a guidebook
    			    $GetTheGuideBook = new WP_Query(array('category__and'=>array(16,$catToUse)));
    //we know the guidebook post will be in category 16 and the current post's subject category
    
    				 if($GetTheGuideBook ->have_posts()) : while($GetTheGuideBook ->have_posts()) : $GetTheGuideBook ->the_post();
    				   $guideBookPostID = $post->ID;
                       $guideLink ='<a href="'. get_permalink() .'" title="' .the_title("", "", false). '">'. the_title("", "", false) .'</a>';
    				   $guideImage = get_post_meta($post->ID, 'guideImage', $single ='true');
    
    				   $guideName = get_post_meta($post->ID, 'guideName', $single ='true');
    
    				   $guidePrice = get_post_meta($post->ID, 'guideAmount', $single ='true');
    
    			     endwhile;
    
    			   endif;
    			 }
    		}
        $wp_query = $tempQuery;
    Thread Starter wpnewbie80

    (@wpnewbie80)

    thank you for replying.

    category 5 is my ebook category. All categories that are a child of category 6 are subjects that an ebook is on.

    an ebook post will also appear in one the subject categories, along with other posts.

    Basically, when viewing a single post within category 5 ie an ebook, i want to display in a floated div, an image and paypal button for that ebook. On posts in a category that is a child of category 6…I want to show in a floated div the ebook for that ‘subject’ but instead of a paypal button, just show a link to the ebook’s post. I can do the necessary for the div / paypal but it is just how to work out which, if any, of the 2 options, I had to do, from within my single.php

    If the post is in a category that is a child of 6, ie it is related to a particular subject, I will then have to get the necessary ebook’s info to display.

    If that makes sense?

    Hello, I have been trying a similar thing..to list posts from a particular category on a Page. My reason for doing it this way is that my Page navigation is displayed via a plugin within a widgetized sidebar.

    Would it still be possible to add a link to a particular category archive to appear within my navigation rather than a link to the Page?

    thanks

    j

    Thread Starter wpnewbie80

    (@wpnewbie80)

    I think I have the code to do what I’m wanting, but I’m a little unsure about the multiple loops involved and if I should be rewinding etc. Am I right in thinking that providing my intended output is to show the ‘guide book’ post,including the meta info, and then show the list of other posts below everything else, ie in my code it is after the initial endwhile, I can just use query_post again without the need to rewind etc?

    Thread Starter wpnewbie80

    (@wpnewbie80)

    I fixed it. my widgeted sidebar was over riding it

Viewing 9 replies - 1 through 9 (of 9 total)