1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hire freelancer to do a small php job

Discussion in 'Hire a Freelancer' started by jason212, Dec 20, 2016.

  1. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    Hey,


    I have a tube site and I want to change my code. If I click on one video it should be open and another tab (with the link which I addded) too. The link can stay in the code. This code is from loop-content.php. I hope its right.

    <?php global $loop_view;
    $ajaxload = get_option('dp_archive_ajaxload');
    ?>

    <div class="loop-content switchable-view <?php echo $loop_view; ?>" data-view="<?php echo $loop_view; ?>" data-ajaxload=<?php echo $ajaxload; ?>>
    <div class="nag cf">
    <?php while (have_posts()) : the_post();
    get_template_part('item-video');
    endwhile; ?>
    </div>
    </div><!-- end .loop-content -->


    You can write me a PM as well
     
  2. ITsolution

    ITsolution BANNED BANNED

    Joined:
    Jun 3, 2015
    Messages:
    198
    Likes Received:
    4
    Add me on Skype vimlendu_2
    I can do it for you.
     
  3. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    Can't find you on skype
     
  4. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    Bump
     
  5. aminima

    aminima Newbie

    Joined:
    Aug 25, 2016
    Messages:
    30
    Likes Received:
    2
    Gender:
    Male
  6. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    Added you. You have to response. I'm still waiting.
     
  7. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
  8. steveseos

    steveseos Jr. VIP Jr. VIP

    Joined:
    Aug 19, 2011
    Messages:
    2,459
    Likes Received:
    361
    Gender:
    Male
    Occupation:
    SEO expert, Designer , Developer
    Location:
    SEO-WORLD
    Home Page:
  9. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    <div class="data">
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permalink to %s', 'dp'), get_the_title()); ?>"><?php the_title(); ?></a></h2>


    here is the right code, it should open the permalink + google.com in a new tab additionally.
     
  10. black cobra

    black cobra BANNED BANNED

    Joined:
    Sep 26, 2016
    Messages:
    300
    Likes Received:
    3
    Gender:
    Male
  11. bzy39

    bzy39 Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    439
    Likes Received:
    241
    Code:
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permalink to %s', 'dp'), get_the_title()); ?>"><?php the_title(); ?></a></h2>
    change to
    Code:
    <h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permalink to %s', 'dp'), get_the_title()); ?>" onclick="window.open('http://google.com');
    return true;"><?php the_title(); ?></a></h2>
     
  12. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    Hello mate, thank you your code works. If I go click on the Link it works but when I click on the Thumbnail it doenst work. I think we have to edit this code too.

    <div id="post-<?php the_ID(); ?>" <?php $item_format = is_video() ? 'video' : 'post'; post_class('item cf item-'.$item_format); ?>>
    <?php
    // Set image size based on section view, only for section box
    global $section_view;
    $thumb_size = 'custom-medium';
    if(!empty($section_view)) {
    if($section_view == 'list-large')
    $thumb_size = 'custom-large';
    elseif($section_view == 'grid-mini')
    $thumb_size = 'custom-small';
    }
    dp_thumb_html($thumb_size);
    ?>


    regards
     
  13. bzy39

    bzy39 Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    439
    Likes Received:
    241
    there no thumb link on the current code, i think it will be on dp_thumb_html function, find the link tag (<a href) on that function, then add
    Code:
    onclick="window.open('http://google.com');
    return true;" 
    inside the tag , like
    Code:
    <a onclick="window.open('http://google.com');
    return true;"  href
     
  14. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    I found this codes on looking for dp_thumb_html

    under: cat-featured.php

    Code:
           // Get items
           $items = '';
           $i = 0;
           while ($query->have_posts()) : $query->the_post();           
               $thumb_html = dp_thumb_html('custom-small', '', '', false);
    
    functions.php

    Code:
    /**
     * Get Video Thumbnail URL
     *
     * @param string $size Optional. Image size. Defaults to 'custom-medium';.
     */
    function dp_thumb_url($size = 'custom-medium', $default = '', $post_id = null, $echo = false){
       global $post;
      
       if(!$post_id)
           $post_id = $post->ID;
       if(!$size)
           $size == 'custom-medium';
      
       /* Check if this video has a feature image */
       if(has_post_thumbnail() && $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size))
           $thumb_url = $thumb[0];
    
       /* If no feature image, try to get thumbnail by "Video Thumbnails" plugin */
       if(empty($thumb_url) && function_exists('get_video_thumbnail')) {
           $video_thumbnail = get_video_thumbnail($post_id);
           if(!is_wp_error($video_thumbnail))
               $thumb_url = $video_thumbnail;
       }
    
       /* If this is a video by jplayer, try to get thumbnail from video_posts */
       if(empty($thumb_url) && $poster = get_post_meta($post_id, 'dp_video_poster', true))
           $thumb_url = $poster;
      
       /* If still no image or is wp error, define default image */
       if(empty($thumb_url) || is_wp_error($thumb_url)) {
           if($default === false || $default === 0)
               return false;
          
           $thumb_url = !empty($default) ? $default : get_template_directory_uri().'/images/nothumb.png';
       }
          
       if($echo)
           echo $thumb_url;
       else
           return $thumb_url;
    }
    /**
     * Display Video Thumbnail HTML
     *
     * @param int $size Optional. Image size. Defaults to 'custom-medium';.
     */
    function dp_thumb_html($size = 'custom-medium', $default = '', $post_id = null, $echo = true) {
       global $post;
      
       if(!$post_id)
           $post_id = $post->ID;
       if(!$size)
           $size == 'custom-medium';
      
       // Get thumb url
       $thumb_url = dp_thumb_url($size, $default, $post_id, false);
    
       $html = '
       <div class="thumb">
           <a class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
               <span class="clip">
                   <img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post_id)).'" /><span class="vertical-align"></span>
               </span>
                              
               <span class="overlay"></span>
           </a>
       </div>';
      
       if($echo)
           echo $html;
       else
           return $html;
    }
    
    functions.php

    Code:
        // Get image
            if (is_singular()) {
               global $post;
              
               // Get image by feature image
               $image = dp_thumb_url('large', false, $post->ID);
    home-featured-full-width.php
    Code:
               <div class="screen">
                   <?php
                       if($i == 1 && !$autoscroll && is_video($post->ID) && $first_post_media == 'video') {
                           echo '<div class="video fluid-width-video-wrapper" data-ratio="16:9">';
                               dp_video($post->ID, $autoplay);
                           echo '</div>';
                       }
                   ?>
                  
                   <?php dp_thumb_html('custom-full'); ?>
               </div>
    home-featured.php

    Code:
                   <?php  
                       dp_thumb_html('custom-large');
                   ?>
    
    home-featured.php

    Code:
        <div class="carousel">
           <div class="carousel-clip">
               <ul class="carousel-list">
                   <?php $items = ''; $i = 0; while ($query->have_posts()) : $query->the_post(); global $post; ?>
                   <li data-id="<?php the_ID(); ?>" class="<?php echo is_video() ? 'item-video' : 'item-post'; ?>">
                   <div class="inner">
                       <?php
                       $thumb_size = 'custom-small';
                       dp_thumb_html($thumb_size);
                       ?>
              
                       <div class="data">
                           <h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permalink to %s', 'dp'), get_the_title()); ?>"><?php the_title(); ?></a></h2>
              
                           <p class="meta">
                               <span class="time"><?php printf(__('%s ago', 'dp'), relative_time(get_post_time('U', true))); ?></span>
                           </p>
                       </div>
                   </div>
                   </li>
                   <?php $i++; endwhile; ?>
    item-video.php

    Code:
        <div id="post-<?php the_ID(); ?>" <?php $item_format = is_video() ? 'video' : 'post'; post_class('item cf item-'.$item_format); ?>>
           <?php
               // Set image size based on section view, only for section box
               global $section_view;
               $thumb_size = 'custom-medium';
               if(!empty($section_view)) {
                   if($section_view == 'list-large')
                       $thumb_size = 'custom-large';
                   elseif($section_view == 'grid-mini')
                       $thumb_size = 'custom-small';
               }
               dp_thumb_html($thumb_size);
           ?>
    
    single.php

    Code:
                   <?php
                   // Thumbnail
                   global $post;
                   $post_type = get_post_type($post_type);
                   $post_format = get_post_format($post->ID);
                   if(!$post_format && $post_type == 'post' && get_option('dp_single_thumb')) {
                       $thumb_url = dp_thumb_url('custom-large', '', $post->ID, false);
                       if(!empty($thumb_url)) {
                           echo '<div id="thumb" class="rich-content"><img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post->ID)).'" /><span class="vertical-align"></div>';
                       }
                   }
                   ?>
    
    widget-posts.php

    Code:
           <?php if ( $title ) echo $before_title . $title . $after_title; ?>
          
           <ul class="<?php echo 'post-'.$style; ?>">
               <?php while ($r->have_posts()) : $r->the_post(); $item_format = is_video() ? 'video' : 'post'; ?>
               <li class="item cf <?php echo 'item-'.$item_format; ?>">
                   <?php
                       $image_size = ($style == 'list-full') ? 'custom-medium' : 'custom-small';
                       dp_thumb_html($image_size);
                   ?>
    widget-related-posts.php

    Code:
           <ul class="<?php echo 'post-'.$style; ?>">
               <?php while ($r->have_posts()) : $r->the_post(); $item_format = is_video() ? 'video' : 'post'; ?>
               <li class="item cf <?php echo 'item-'.$item_format; ?>">
                   <?php
                       $image_size = ($style == 'list-full') ? 'custom-medium' : 'custom-small';
                       dp_thumb_html($image_size);
                   ?>
    Thank you
     
  15. bzy39

    bzy39 Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    439
    Likes Received:
    241
    find this code, inside function dp_thumb_html in file functions.php
    Code:
          <a class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
    
    change to

    Code:
          <a onclick="window.open('http://google.com'); return true;" class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
    
    because widely use of dp_thumb_html function in various files, every thumb link that use that function will have same effect, open google on another tab.
     
    Last edited: Dec 27, 2016
  16. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    The site doenst work when I change the code:

    Code:
     
    <div class="thumb">
           <a class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
               <span class="clip">
                   <img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post_id)).'" /><span class="vertical-align"></span>
               </span>
                               
               <span class="overlay"></span>
           </a>
       </div>';
    
    to

    Code:
    <div class="thumb">
                 <a onclick="window.open('http://google.com'); return true;" class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
               <span class="clip">
                   <img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post_id)).'" /><span class="vertical-align"></span>
               </span>
                               
               <span class="overlay"></span>
           </a>
       </div>';
    
     
  17. simno

    simno Junior Member

    Joined:
    Apr 20, 2012
    Messages:
    191
    Likes Received:
    44
    Gender:
    Male
    Occupation:
    Web Developing, Online Marketing, Graphic Design
    Contact me on my website anytime, I will help you immediately with this kind of questions. FreelancerSimon.com
     
  18. bzy39

    bzy39 Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    439
    Likes Received:
    241
    fixed

    Code:
         <a onclick="window.open(\'http://google.com\'); return true;" class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
    
     
  19. jason212

    jason212 Junior Member

    Joined:
    Feb 21, 2015
    Messages:
    150
    Likes Received:
    14
    Still doenst work with this code:

    Code:
     
    
    function dp_thumb_html($size = 'custom-medium', $default = '', $post_id = null, $echo = true) {
       global $post;
       
       if(!$post_id)
           $post_id = $post->ID;
       if(!$size)
           $size == 'custom-medium';
       
       // Get thumb url
       $thumb_url = dp_thumb_url($size, $default, $post_id, false);
    
       $html = '
       <div class="thumb">
           <a onclick="window.open(\'http://google.com\'); return true;" class="clip-link" data-id="'.$post->ID.'" title="'.esc_attr(get_the_title($post_id)).'" href="'.get_permalink($post_id).'">
               <span class="clip">
                   <img src="'.$thumb_url.'" alt="'.esc_attr(get_the_title($post_id)).'" /><span class="vertical-align"></span>
               </span>
                               
               <span class="overlay"></span>
           </a>
       </div>';
       
       if($echo)
           echo $html;
       else
           return $html;
    }
    The site is blank.
     
  20. bzy39

    bzy39 Regular Member

    Joined:
    Jan 15, 2009
    Messages:
    439
    Likes Received:
    241
    tested the partial code on my localhost, it worked, if you have teamviewer, send the id and pass via PM.
     
    • Thanks Thanks x 1