Is there a way i can edit the attachment page on wordpress theme i want my picture to be in full size and add some banners at the top am using Bussinesx Front Page Theme

Recommended Answers

All 5 Replies

Member Avatar

The css for the image should be set to cover

Am displaying the images in WordPress Gallery and i cannot see option to change the CSS of the image.

Member Avatar

You realise that we may not have that template to hand, right? Not sure what you expect us to be able to do, other than download a fresh install of WP, apply your theme (if we can find it) and then have a look at the theme templates.

You mention Gallery - why is that important? I thought you wanted to apply an image (uploaded into your Media) as the banner image. Also you mention you want to "add some banner at the top". Well, how are we supposed to know what you need to do unless you show relevant code?

commented: Show code, win friends. +12

Right now the attachment page contain the gallery clicked/choosen image but in a small resolution i think its thumbnail size by default, so you must click on it and it will redirect you to the actual file URL so you will be able to see it in full resolution. I want to make when you click the gallery image the same image to be shown in attachment page but in larger resolution so to be 100% width and height and also if possible to dont redirect you to the actual file URL when you click it again. Here is the full code of the attachments.php page in wordpress.


 * Get the attachment src, but also have the option of getting the fallback URL.
 * @param $attachment
 * @param $size
 * @param bool|false $fallback
 * @return array|bool|false
function siteorigin_widgets_get_attachment_image_src( $attachment, $size, $fallback = false ){
    if( empty( $attachment ) && !empty($fallback) ) {
        $url = parse_url( $fallback );

        if( !empty($url['fragment']) && preg_match('/^([0-9]+)x([0-9]+)$/', $url['fragment'], $matches) ) {
            $width = intval($matches[1]);
            $height = intval($matches[2]);
        } else {
            $width = 0;
            $height = 0;

        // TODO, try get better values than 0 for width and height
        return array( $fallback, $width, $height, false );
    if(!empty($attachment)) {
            return wp_get_attachment_image_src( $attachment, $size );

    return false;

function siteorigin_widgets_get_attachment_image( $attachment, $size, $fallback ){
    if( !empty( $attachment ) ) {
        return wp_get_attachment_image( $attachment, $size );
    } else {
        $src = siteorigin_widgets_get_attachment_image_src( $attachment, $size, $fallback );
        if( empty($src[0]) ) return '';

        $atts = array(
            'src' => $src[0],

        if( !empty($src[1]) ) $atts['width'] = $src[1];
        if( !empty($src[2]) ) $atts['height'] = $src[2];

        $return = '<img ';
        foreach( $atts as $id => $val ) {
            $return .= $id . '="' . esc_attr($val) . '" ';
        $return .= '>';
        return $return;


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.