• Hello,
    For now i’m using such code in single.php to insert images into post:

    <strong>
    Other photos:
    </strong>
    <?php echo do_shortcode('[gallery option1="value1"]'); ?>

    and such code to insert other type attachments:

    <strong>
    Other attachments:
    </strong>
    <ul>
    <?php
    	$args = array(
    		'post_type' => 'attachment',
    		'post_mime_type' => 'application/pdf,application/msword',
    		'numberposts' => -1,
    		'post_status' => null,
    		'post_parent' => $post->ID,
    		'orderby' => 'menu_order',
    		'order' => 'desc'
    		);
    	$attachments = get_posts($args);
    	if ($attachments) {
    		foreach ($attachments as $attachment) {
    		echo '<li><a href="'.wp_get_attachment_url($attachment->ID).'">';
    		echo $attachment->post_title;
    		echo '</a></li>';
    		}
    	}
    ?>
    </ul>

    The problem i have is that even when there is no any images or attachments there is always written such text in the post:
    Other photos:
    Other attachments:

    How to make these texts to appear if only there is uploaded images or other attachment types?

    Thanks in advance..!

Viewing 1 replies (of 1 total)
  • Thread Starter vicius

    (@vicius)

    Maybe it’s too complicated to answer it here in forum and I should think about ordering some professional services to solve that..?

    Thanks in advance..!

Viewing 1 replies (of 1 total)
  • The topic ‘Inserting images ant other attachments into post’ is closed to new replies.