WordPress.org

Ready to get started?Download WordPress

Forums

How to edit the original gallery-feature of WP? (4 posts)

  1. stereopoly
    Member
    Posted 5 years ago #

    hey guys,
    when using the standard gallery within my articles, the images will be opened on a new page. that's nice. but how can i edit this new page? where do i find the code? is it simply the page.php or stuff like that?

    for example: i'd love to remove the title from this image-page and also the sidebar. but how to? hope you understand my english! if not: please ask. i really need your help! thanks.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 5 years ago #

    When a visitor clicks on an image whose link has been set to Post URL, WordPress looks for certain templates in the following order:

    1. image.php
    2. attachment.php
    3. single.php
    4. index.php

    So, if you do not currently have an image.php or attachment.php file in your theme, you'll need to create one first. I'd suggest you make a copy of single.php to get you started, then strip out the sidebar and image title as needed.

  3. stereopoly
    Member
    Posted 5 years ago #

    Thanks! One more problem: when havin made a copy of single.php and renamin it into image.php, it works: every image in a gallery will use this template, but there is no image shown on its single-page. any ideas?

  4. Michael Fields
    Themer
    Posted 4 years ago #

    @stereopoly,
    I would suggest that you base you image.php file on the default theme's image.php... there are special template tags that are not used in page.php. Some of which are:

    wp_get_attachment_url()
    previous_image_link()
    next_image_link()

    Also, see this plugin if you do not like how WordPress uses images for it's previous and next navigation:

    http://mfields.org/wordpress-plugins/text-based-image-links/

Topic Closed

This topic has been closed to new replies.

About this Topic