WordPress.org

Ready to get started?Download WordPress

Forums

all image code problem (9 posts)

  1. cinisli
    Member
    Posted 2 years ago #

    Hello, i have this code to show all images in page. i saved template-all-images.php and placed in themes folder. than Under the Page Attributes meta box, i select the "All Images" and publish.

    but it is not working. did do something wrong?

    [Code moderated as per the Forum Rules. Please use the pastebin]

    http://pastebin.com/TN4jdpP4

  2. keesiemeijer
    moderator
    Posted 2 years ago #

    Try it with:

    echo wp_get_attachment_image( get_the_ID(), 'thumbnail' );

    http://codex.wordpress.org/Function_Reference/wp_get_attachment_image

  3. cinisli
    Member
    Posted 2 years ago #

    Hello, thanks for your help.

    now some images appears but not all of them, and they are not link.

    http://www.1907.net/deneme/

    do you have any idea?

  4. keesiemeijer
    moderator
    Posted 2 years ago #

    Try setting posts_per_page to -1:

    $images_query_args = array(
        'post_type' => 'attachment',
        'post_status' => 'inherit',
        'post_mime_type' => 'image',
        'posts_per_page' => -1
    );
  5. keesiemeijer
    moderator
    Posted 2 years ago #

    Try wp_get_attachment_link() to get a linked image: http://codex.wordpress.org/Function_Reference/wp_get_attachment_link

  6. cinisli
    Member
    Posted 2 years ago #

    one last question, how am i going to edit css this page. how to add this page to style.css

    thanks for your help

  7. keesiemeijer
    moderator
    Posted 2 years ago #

    Look at the structure of your theme's normal page.php and apply it to this custom template.

  8. cinisli
    Member
    Posted 2 years ago #

    in my themes page.php i have this code:

    <?php if (get_post_meta($post->ID, 'header_choice_select', true));{ get_header(get_post_meta($post->ID, 'header_choice_select', true)); } ?>
    <div id="content_full" >
    <?php breadcrumbs_plus(); ?>
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    <?php endwhile; // end of the loop. ?>
    <?php get_template_part( 'loop', 'page' ); ?>
    <?php SEO_pager() ?>
    </div><!-- #content -->
    <?php get_footer(); ?>

    i added it to the template-all-images.php now page is not working all white.

  9. browsewire
    Member
    Posted 2 years ago #

    Hello cinisli:

    AS your question describe you want to display images attached to the posts. If images are featured images then you should use get_the_post_thumbnail($post->ID,'thumbnail');

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags