• Resolved feelfree

    (@feelfree)


    I am currently working on my university project trying to build a child theme for an e-comm site. I have a unique problem.
    Site URL (Under Construction)
    https://www.numyspace.co.uk/~unn_w10023996/finewoodworksseq/wordpress/

    On the home page, I dont want to display any product description. I tried hiding it but the description is inside the image tag so that didnt work. Then I tried – entry-content p:last-child {display:none}
    That didnt work either.

    Problem is the classes are all same. I want to display the description on product page but not on the home page.

    Can anyone help? please ??
    Amit

Viewing 9 replies - 16 through 24 (of 24 total)
  • Just to cover all the bases: the images actually *are* attached to each individual Post, right?

    Thread Starter feelfree

    (@feelfree)

    Yes. Images are uploaded from my hard driver. Each post contains 1 image with a few lines of text (product description)

    Right, but each image is attached to the Post? That is, if you open the Media Manager (click “Add Image” from within the Post-Edit screen), you see the image listed under the “Gallery” tab?

    Thread Starter feelfree

    (@feelfree)

    Thats right. All the images are posted under the Media library.

    Okay, can you post the full, as-modified code of “content.php” again?

    Thread Starter feelfree

    (@feelfree)

    content.php

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

    Did you try using:

    <?php the_post_thumbnail( 'size' ); ?>

    rather than

    <?php echo wp_get_attachment_image($attachment_id, $size='full', $icon = false ); ?>

    Also, where do you define $attachment_id?

    Also, your argument syntax is wrong. Try this instead:

    <?php echo wp_get_attachment_image( $attachment_id, 'full', false ); ?>

    But you still need to define $attachment_id.

    Here’s how I define it:

    $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
    // If there are attached images, count them
    $total_images = ( $images ? count( $images ) : '0' );
    // If there are attached images, get the first one
    $image = ( $images ? array_shift( $images ) : false );
    // If there are attached images, grab the markup of the first image
    $image_img_tag = ( $image ? wp_get_attachment_image( $image->ID, 'thumbnail' ) : false );

    Thread Starter feelfree

    (@feelfree)

    Ok I will try this now.

    Thank you for your help, really appreciate it.

    Amit

    Thread Starter feelfree

    (@feelfree)

    There was a simpler solution this issue. Using the featured image function on post entry page to display the main image on index.php. This also gives me an option to have more images on the actual post page.

    Amit

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘Problem hiding the post description’ is closed to new replies.