Forum Replies Created

Viewing 15 replies - 16 through 30 (of 128 total)
  • Thread Starter dunkkan

    (@dunkkan)

    All is ok now. The question would be : why WP doesn’t works the linked images in a post as attachments ?

    Anyway I mark this thred as resolved.

    Thread Starter dunkkan

    (@dunkkan)

    Ok I think that retrieving attachments works only with uploaded images/media πŸ™‚

    I was linking images and pretending they were attachments. I’ll try it now and I’ll post back.

    Thread Starter dunkkan

    (@dunkkan)

    This would be for the images part, and I know I could change the post_mime_type to include any other file, but this isn’t even printing a simple image. πŸ™

    <?php
            $images =& get_children( 'post_parent='.
            $post->ID.'&post_type=attachment&post_mime_type=image' );
    ?>
    <?php echo wp_get_attachment_image( $image->ID ); ?>
    Thread Starter dunkkan

    (@dunkkan)

    It doesn’t seems to need the ‘&’ as a “connector”, maybe because there’s only one parameter : the offset ?

    It’s in fact my main loop in index.php, and the only special parameter would be that offset (before that, I have another loop with a wp_query).

    But don’t trust me, I’m not sure to do things totally right (even if the pagination works now), so any clarification would be cool.

    Thread Starter dunkkan

    (@dunkkan)

    Awesome !

    Here’s my final code :

    <?php query_posts ($query_string.'offset=1') ; ?>
    		<?php
    		if (have_posts()) :
    		while (have_posts()) :
    	      the_post();
    		?>
    		<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    		<?php the_excerpt(); ?>
    		<?php endwhile;
    		endif;
    		?>

    I just deleted the & , which seemed to interfere in '&offset=1');.

    Many thanks.

    Thread Starter dunkkan

    (@dunkkan)

    Ok, sorry.

    the ‘p’ tag which defines the text is under control now (I had some extra padding).

    If you need to make smaller the whole caption (because if your original images are huge the caption will break all), just use the max-width, to the div:

    div .wp-caption{
    		max-width:500px;
    		}

    Thread Starter dunkkan

    (@dunkkan)

    Here I found and easy, clean way too

    <?php
    $mycats=get_categories ('include=14');
    echo 'my cat count is '. $mycats[0]->category_count;
    ?>

    That’s working perfectly.

    Hi daisybee,

    This must be something in the CSS. You can paste this at the end of your CSS stylesheet :

    p { margin-top: 18px }

    Another cause can be that in the editor the <p>Text</p> tags are not correctly set, which happens sometimes when copy pasting text from here and there.

    Thread Starter dunkkan

    (@dunkkan)

    I’m retaking this tread :)

    I’m playing locally with a WP install, and in my theme I’ve had the occasion to compare the two.

    For me, get_posts is having a faster loading.

    Is it my template ?
    Here’s a diagram of my index.php :

    get_posts(featured1)-------get_posts(featured2)-------get_posts(featured3)
    ----------a list : get_posts(again, simply the 10 last posts) --------

    There, I realised I could not control, from the Admin Panel, how many posts I was calling in the Index, without editing the template. They were always 10, and some future user wouldn’t like it, nor going to templating, so I went this way :

    WP_query(featured1)-------WP_query(featured2)-------WP_query(featured3)
    ------------------------------a normal loop---------------------------

    Maybe it’s the quantity of WP_query I’m calling, but it’s a bit slower, and the images takes a bit more time than with get_posts.

    If anyone have some idea why / how to improve it / confirm it / comment it … I’d like to optimize the template.

    Thanks for any input,

    Thread Starter dunkkan

    (@dunkkan)

    Thanks !

    Here’s the code I finished with :

    <?php
    		$category = get_cat_ID( 'Custom1');
    
    		$params = array(
    		'title_li' => '',
    		'include'   => $category );
    
    		wp_list_categories($params);
     ?>

    The rest is some basic HTML and CSS to create an horizontal navbar, and the code repeats for each div, changing the custom# category.

    Thanks Michael for that one.

    Do you think there’s a better code to pass the params/print them ?

    Thread Starter dunkkan

    (@dunkkan)

    Hi zukny, did you paste the code in the end of your style.css file ?

    It’s important it be in the end of the file, just to overwrite any other styling code that can be affecting your posts.

    Then, you must use Mozilla Firefox, which renders those rounded corners (IE still doesn’t do it).

    With IE, you will get a standart corner, but the rest of the caption (clair-grey background, normal-grey border) should still be perfectly visible.

    Thread Starter dunkkan

    (@dunkkan)

    Thanks Ornani, the lack of documentation was strange to me (because is an easy issue probably). Good to read some opinion though.

    Thread Starter dunkkan

    (@dunkkan)

    Maybe is impossible ? I’ve googled the matter and I’ve found really nothing, there’s only the discussion between choosing one or the other but nothing about a ‘mix’… (so yeah, bump)

    Forum: Fixing WordPress
    In reply to: Custom Fields

    An example of custom field :

    <div class="loopinindex">
    
    		<!-- starting the loop -->
    
    		<?php
    		if (have_posts()) :
    		while (have_posts()) :
    	        the_post();
    		?>
    
    		<?php the_title(); ?>
    		<?php the_content(); ?>
    
    		<!-- pulling the custom field -->
    
    		<?php
    		$music = get_post_meta($post->ID, "listening", true); ?>
    
    		<!-- printing the custom field -->
    
    		<?php echo $music ; ?>
    
    		<?php endwhile;
    		endif;
    		?>
    </div>

    listening being the name of the custom field.
    Hope that helps.

Viewing 15 replies - 16 through 30 (of 128 total)