我不熟悉过滤器和操作,我开始发现它们有多有用。然而,我确实需要一些帮助来解决以下问题。
我想从中删除html代码
<?php if ( $atts[\'columns\'] != 0 && $i % $atts[\'columns\'] == 0 ) { ?><div style="clear:both;"></div><?php } ?>
我的函数中的下面一个。php
<?php if ( $atts[\'columns\'] != 0 && $i % $atts[\'columns\'] == 0 ) { ?> <?php } ?>
有人能给我指出正确的方向吗?
完整源代码:
// Allow the query to be manipulated by other plugins
$query = apply_filters( \'edd_downloads_query\', $query, $atts );
$downloads = new WP_Query( $query );
if ( $downloads->have_posts() ) :
$i = 1;
$wrapper_class = \'edd_download_columns_\' . $atts[\'columns\'];
ob_start(); ?>
<div class="edd_downloads_list <?php echo apply_filters( \'edd_downloads_list_wrapper_class\', $wrapper_class, $atts ); ?>">
<?php while ( $downloads->have_posts() ) : $downloads->the_post(); ?>
<?php $schema = edd_add_schema_microdata() ? \'itemscope itemtype="http://schema.org/Product" \' : \'\'; ?>
<div <?php echo $schema; ?>class="<?php echo apply_filters( \'edd_download_class\', \'edd_download\', get_the_ID(), $atts, $i ); ?>" id="edd_download_<?php echo get_the_ID(); ?>" style="width: <?php echo $column_width; ?>; float: left;">
<div class="edd_download_inner">
<?php
do_action( \'edd_download_before\' );
if ( \'false\' != $atts[\'thumbnails\'] ) :
edd_get_template_part( \'shortcode\', \'content-image\' );
do_action( \'edd_download_after_thumbnail\' );
endif;
edd_get_template_part( \'shortcode\', \'content-title\' );
do_action( \'edd_download_after_title\' );
if ( $atts[\'excerpt\'] == \'yes\' && $atts[\'full_content\'] != \'yes\' ) {
edd_get_template_part( \'shortcode\', \'content-excerpt\' );
do_action( \'edd_download_after_content\' );
} else if ( $atts[\'full_content\'] == \'yes\' ) {
edd_get_template_part( \'shortcode\', \'content-full\' );
do_action( \'edd_download_after_content\' );
}
if ( $atts[\'price\'] == \'yes\' ) {
edd_get_template_part( \'shortcode\', \'content-price\' );
do_action( \'edd_download_after_price\' );
}
if ( $atts[\'buy_button\'] == \'yes\' )
edd_get_template_part( \'shortcode\', \'content-cart-button\' );
do_action( \'edd_download_after\' );
?>
</div>
</div>
<?php if ( $atts[\'columns\'] != 0 && $i % $atts[\'columns\'] == 0 ) { ?><div style="clear:both;"></div><?php } ?>
<?php $i++; endwhile; ?>
<div style="clear:both;"></div>
<?php wp_reset_postdata(); ?>
<?php
$pagination = false;
if ( is_single() ) {
$pagination = paginate_links( apply_filters( \'edd_download_pagination_args\', array(
\'base\' => get_permalink() . \'%#%\',
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, $query[\'paged\'] ),
\'total\' => $downloads->max_num_pages
), $atts, $downloads, $query ) );
} else {
$big = 999999;
$search_for = array( $big, \'#038;\' );
$replace_with = array( \'%#%\', \'&\' );
$pagination = paginate_links( apply_filters( \'edd_download_pagination_args\', array(
\'base\' => str_replace( $search_for, $replace_with, get_pagenum_link( $big ) ),
\'format\' => \'?paged=%#%\',
\'current\' => max( 1, $query[\'paged\'] ),
\'total\' => $downloads->max_num_pages
), $atts, $downloads, $query ) );
}
?>
<?php if ( ! empty( $pagination ) ) : ?>
<div id="edd_download_pagination" class="navigation">
<?php echo $pagination; ?>
</div>
<?php endif; ?>
</div>
<?php
$display = ob_get_clean();
else:
$display = sprintf( _x( \'No %s found\', \'download post type name\', \'edd\' ), edd_get_label_plural() );
endif;
return apply_filters( \'downloads_shortcode\', $display, $atts, $atts[\'buy_button\'], $atts[\'columns\'], $column_width, $downloads, $atts[\'excerpt\'], $atts[\'full_content\'], $atts[\'price\'], $atts[\'thumbnails\'], $query );
}
add_shortcode( \'downloads\', \'edd_downloads_query\' );