Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter kadorrna

    (@kadorrna)

    I have solved bringing the image in other way (better maybe)

    function getPostImageByTitle($postid, $imageName,$orderBy="DESC"){
    	global $wpdb;
    
    	$querystr = "SELECT ".$wpdb->posts.".* FROM ".$wpdb->posts." WHERE ".$wpdb->posts.".post_parent = ".$postid.
    	    " AND ".$wpdb->posts.".post_type = 'attachment'
    	    AND (".$wpdb->posts.".post_mime_type = 'image/png'
    	    		OR ".$wpdb->posts.".post_mime_type = 'image/gif' OR ".$wpdb->posts.".post_mime_type = 'image/jpeg')
    	    AND ".$wpdb->posts.".post_status = 'inherit'
    	    AND ".$wpdb->posts.".post_title = '".$imageName."'
    	    ORDER BY $wpdb->posts.post_date ".$orderBy;
    
    	$image = $wpdb->get_results($querystr, OBJECT);
    
    	if (sizeof($image) == 1){
    			the_attachment_link($image[0]->ID);
    			//return $image[0]->guid;
    	}
    	else{
    		if ($imageName == "post"){
    			echo "<img src='".get_bloginfo('template_url')."/images/homeGeneric.png' />";
    		}elseif ($imageName == "icon"){
    			echo "<img src='".get_bloginfo('template_url')."/images/notfound.png' />";
    		}
    	}
    }

    Before I was returning the guid now I am using the_attachment_link function.

    Cheers.

    Forum: Hacks
    In reply to: Question about galleries
    Thread Starter kadorrna

    (@kadorrna)

    I have found this way:

    function getPostImageByTitle($postid, $imageName,$orderBy="DESC"){
    	global $wpdb;
    
    	$querystr = "SELECT ".$wpdb->posts.".* FROM ".$wpdb->posts." WHERE ".$wpdb->posts.".post_parent = ".$postid.
    	    " AND ".$wpdb->posts.".post_type = 'attachment'
    	    AND (".$wpdb->posts.".post_mime_type = 'image/png'
    	    		OR ".$wpdb->posts.".post_mime_type = 'image/gif' OR ".$wpdb->posts.".post_mime_type = 'image/jpeg')
    	    AND ".$wpdb->posts.".post_status = 'inherit'
    	    AND ".$wpdb->posts.".post_title = '".$imageName."'
    	    ORDER BY $wpdb->posts.post_date ".$orderBy;
    
    	return $wpdb->get_results($querystr, OBJECT);
    }

    I will leave this as not resolved for a couple of days looking forward for other ideas. If nobody gives any other solution I will close it.

    Cheers!

    Thread Starter kadorrna

    (@kadorrna)

    Thanks for the answer govpatel the_content() brings me everything, including the image. I don’t need the image. That’s why the_excerpt() helped me this time!

    Regards.

    Thread Starter kadorrna

    (@kadorrna)

    After a few hours looking around I found “the_excerpt()” and I filtered by <img>.
    So I can do It as I first thought it. Anyways if anyone wants to give me some advice in my problem (other solutions) will be welcome.

    Thanks.

    Thread Starter kadorrna

    (@kadorrna)

    Ok Finally I find out the category Id (From the url), and I am using it. So that’s the en of part of the problem.

    About the posts I manage to make it work with the link that alchymyth gave me.

    The theoretical question about if it is well done in this way or not, I think that will not be necessary to be answered… I will do it this way because is the easiest way I figured out.

    So we can finish this thread and mark it as Done.

    Thread Starter kadorrna

    (@kadorrna)

    I think that I am mixing up category of a post with category.php.

    I found out this and now I really have a mess in my head.

    Regards!

    Thread Starter kadorrna

    (@kadorrna)

    First of all, thanks for the answers.

    I read the documentation of get_posts() before posting this. Maybe I need a second reading because I am not understanding something… XD

    About the categories, When I wrote my post I have in that place a box with Categories.
    Uncategorized and one that I created. There are no Numbers or ids for those categories.
    Maybe I am doing it wrong…

    Regards!

    Thread Starter kadorrna

    (@kadorrna)

    Finally done,

    I was including the css file old fashion way:
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
    I have to include it like this:
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

    Thanks a lot for all the help ??

    Thread Starter kadorrna

    (@kadorrna)

    Jason, Thanks a lot for all your time and help.

    Now I can’t make my template to use the css styles I don’t know why. It has the layout, but the images aren’t shown…

    any idea?

    Thanks again for everything.

    Thread Starter kadorrna

    (@kadorrna)

    Hi Jason, thanks for that explanation.

    I have my page with my design and I am trying to put wordpress to manage the content.

    I was following this tutorial:
    https://www.youtube.com/watch?v=1o2XcHqQbRY

    But I find that only with kado.php and puting the template name doesn’t work.
    I can’t find what I am missing.

    Thanks again, now I will try what you recommend me.

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