dongsu1539 2013-05-16 23:21
浏览 49
已采纳

将项目组合项目指向单个项目并禁用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 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?