dongsu1539
2013-05-16 23:21 阅读 43

将项目组合项目指向单个项目并禁用ajax脚本wordpress主题

At the moment on my portfolio page you can click on a portfolio item and a ajax container pops up. And in this container you can click on a button to go to the project and read more details.

BUT

I want to disable this ajax container and when you click on a single portfolio item it needs to go straight to the project item page with all the details on it etc.

Now have I been searching in all of the .php files and in the scripts but I just can't find the action when you click on a portfolio item and I'm not really sure with what I need to replace it when found. I hope someone could help me with this one.

Here is the code of the portfolio page:

<div id="portfolio-grid" class="clearfix">
<?php
        while ( $portfolio_query->have_posts() ) : $portfolio_query->the_post();        
        get_template_part( 'includes/entry', 'portfolio' );
    endwhile; 
    wp_reset_postdata(); 
?>
</div> <!-- end #portfolio-grid -->   

And here is the code of the Ajax container -I think-

function et_show_ajax_project(){
global $wp_embed;

$project_id = (int) $_POST['et_project_id'];

$portfolio_args = array(
    'post_type' => 'project',
    'p' => $project_id
);
$portfolio_query = new WP_Query( apply_filters( 'et_ajax_portfolio_args', $portfolio_args ) );
while ( $portfolio_query->have_posts() ) : $portfolio_query->the_post();
    global $post;
    $width = apply_filters( 'et_ajax_media_width', 600 );
    $height = apply_filters( 'et_ajax_media_height', 480 );

    $media = get_post_meta( $post->ID, '_et_used_images', true );
    echo '<div class="et_media">';
        if ( $media ){
            echo '<div class="flexslider"><ul class="slides">';
            foreach( (array) $media as $et_media ){
                echo '<li class="slide">';

                if ( is_numeric( $et_media ) ) {
                    $et_fullimage_array = wp_get_attachment_image_src( $et_media, 'full' );
                    if ( $et_fullimage_array ){
                        $et_fullimage = $et_fullimage_array[0];
                        echo '<img src="' . esc_url( et_new_thumb_resize( et_multisite_thumbnail($et_fullimage ), $width, $height, '', true ) ) . '" width="' . esc_attr( $width ) . '" height="' . esc_attr( $height ) . '" />';
                    }
                } else {
                    $video_embed = $wp_embed->shortcode( '', $et_media );

                    $video_embed = preg_replace('/<embed /','<embed wmode="transparent" ',$video_embed);
                    $video_embed = preg_replace('/<\/object>/','<param name="wmode" value="transparent" /></object>',$video_embed); 
                    $video_embed = preg_replace("/height=\"[0-9]*\"/", "height={$height}", $video_embed);
                    $video_embed = preg_replace("/width=\"[0-9]*\"/", "width={$width}", $video_embed);

                    echo $video_embed;                              
                }
                echo '</li>';
            }
            echo '</ul></div>';
        } else {
            $thumb = '';
            $classtext = '';
            $titletext = get_the_title();
            $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Ajaximage');
            $thumb = $thumbnail["thumb"];
            echo '<a href="'. esc_url( get_permalink() ) . '">';
                print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext);
            echo '</a>';
        }
    echo '</div> <!-- end .et_media -->';

    echo    '<div class="et_media_description">' . 
                '<h2 class="title">' . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . '</h2>' .
                truncate_post( 560, false );

    echo '</div> <!-- end .et_media_description -->';

    echo '<a class="more" href="' . get_permalink() . '">' . __( 'Meer info &raquo;', 'Flexible' ) . '</a>';
endwhile; 
wp_reset_postdata();

die();

}
You can see the page here: http://bit.ly/10BDVVf

Again thank you!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    douyingtai6662 douyingtai6662 2013-05-16 23:54

    This is being controlled via javascript in /wp-content/themes/Flexible/js/custom.js. Comment out lines 29-77 and it will link as expected (the return false at the end cancels that standard navigation), but keep in mind that if you edit the theme directly and upgrade it, your changes will be overwritten.

    点赞 评论 复制链接分享

相关推荐