• Resolved downfast

    (@downfast)


    I tried this with no luck

    <?php
    	$my_postid = 3105;
    	$content_post = get_post($my_postid);
    	$content = $content_post->post_content;
    	$content = apply_filters('the_content', $content);
    	echo $content;
    ?>
Viewing 1 replies (of 1 total)
  • Thread Starter downfast

    (@downfast)

    I had to use global $post;

    Final code:

    <?php
                global $post;
                $args        = array(
                    'post_type' => 'attachment',
                    'numberposts' => -1,
                    'post_status' => null,
                    'post_parent' => $post->post_parent,
                    'order_by' => 'menu_order',
                    'order' => 'ASC'
                );
                $attachments = get_posts($args);
                if ($attachments) {
                    echo '<div id="gallery-1" class="gallery galleryid-3105 gallery-columns-5 gallery-size-thumbnail">';
                    foreach ($attachments as $attachment) {
                        echo '<dl class="gallery-item">';
                        echo '<dt classs="gallery-icon">';
                        $large = wp_get_attachment_image_src($attachment->ID, 'large');
                        $thumb = wp_get_attachment_image($attachment->ID, 'thumbnail');
                        echo '<a href="' . $large[0] . '" rel="shadowbox[sbalbum-3105];player=img;">' . $thumb . '</a>';
                        echo '</dt>';
                        echo '</dl>';
                    }
                    echo '</div>';
                }
    ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to get parent content?’ is closed to new replies.