• Resolved storytellervoice

    (@storytellervoice)


    Hi to all and thanks in advance for any help.
    I’ve “acquired” the management of the website of my faculty.
    in the home page there is a background image that I need to change time by time until now I’ve solved renaming the image as the original (everything goes to survive…) bow I need to change the full path but I can’t find how to replace the address
    the statement is this

    function ISIA_home_pic() {
    if (is_front_page()) { ?>
    <?php if (has_post_thumbnail( $post->ID ) ): ?>
    <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘single-post-thumbnail’ ); ?>
    <div class=”homeBox” style=”background-image: url(‘<?php echo $image[0]; ?>’)”>
    <div class=”homeBox-title”>
    <p>
    <span>
    <?php $postselected = get_post($post->ID);
    $homecontent = $postselected->post_content;
    $new_content = strip_tags($homecontent);
    $new_content_trimmed= trim($new_content);
    echo $new_content_trimmed;
    ?>
    </span>
    where can I find the real address to change?

    Have a good day, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The image to be displayed is the featured image of the post in question. It’s created when someone has made use of the Featured Image box on the right in the post admin.

    wp_get_attachment_image_src is providing an array of information, the first part of which is the URL of the featured image. That’s then being used to create the background-image of your homeBox div.

    If you view the source of your site where that image is displayed, you’ll see the image URL in full.

    Thread Starter storytellervoice

    (@storytellervoice)

    Thanks WPR!
    the five minutes idiot happens…
    Solved in 2 seconds.
    Thank you so much ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘home page image by echo $image[0]’ is closed to new replies.