GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Wordpress Help: How to convert thumbnail custom field to featured image (https://gfy.com/showthread.php?t=1100835)

tonyparra 02-22-2013 07:58 AM

Wordpress Help: How to convert thumbnail custom field to featured image
 
I hate when i buy a cool looking wp theme only to find out that the author made it impossible to edit. I recently purchased the cooolzine theme at themeforest and its a great looking theme, however I want to use it on a site that used to use custom fields for the thumbnail, and the theme seems to only work with the featured thumb. Usually when i find an issue like that with a theme i edit it to either use a php statement that uses the featured thumb or a image script like timthumb, or i like to use the get_the_image plugin by justin tadlock. However this theme calls the thumb in a way that i dont understand, so i wonder is there a plugin or script i could run to link images stored on the server in a custom field to the post thumbnail feature. Here a sample of the code if anyone want to take a whack. Also if you can code this reasonably fast hit me up let me know how much and how soon.

Code:

<div class="box article '.$cat[$firstcat]->slug.' '.$tagclass.'">
<div class="text">';

        if (!empty($image)){
       


                $extralen = 0;
               
                $ret .= '
                        <div class="thumb">
                                <img src="'.$src[0].'" alt="'.$post->post_title.'" title="'.$post->post_title.'" />

                                <a href="'.get_permalink($post->ID).'">'.__('read more').'</a>
                        </div><!--thumb-->
                ';
               
        } // has images


        if ($tlen >= 1 && $tlen <= 20) {
                $headrows = 1;
                $alen = 160 + $extralen;
        }
       
        if ($tlen > 20 && $tlen <= 40) {
                $headrows = 2;
                $alen = 115 + $extralen;
        }
       
        if ($tlen > 40 && $tlen <= 66) {
                $headrows = 3;
                $alen = 100 + $extralen;
        }
       
        if ($tlen > 66 && $tlen <= 88) {
                $headrows = 4;
                $alen = 55 + $extralen;
        }
       
        if ($tlen > 88) {
                $alen = 55 + $extralen;
        }
                                                                                                       
    $pattern = get_shortcode_regex();
        $clean = strip_tags(preg_replace('/'.$pattern.'/s', '$1$6', $post->post_content));
       
        $cut = substr($clean,0,$alen);



$ret .= '<div class="meta"><a class="cat-'.$cat[$firstcat]->slug.'" href="'.get_category_link($cat[$firstcat]->cat_ID).'">'.$cat[$firstcat]-

>name.'</a></div><!--meta-->
        <h2 class="hyphenate"><a href="'.get_permalink($post->ID).'">'.$post->post_title.'</a></h2>
        <a href="'.get_permalink($post->ID).'">
                <span class="hyphenate">
                '.$cut.' &rsaquo;
                </span>
        </a>
</div><!--text-->


tonyparra 02-22-2013 08:54 AM

Note to self: dont ever buy another wordpress theme :disgust if it aint free it aint for me

fris 02-22-2013 09:27 AM

might be a plugin to convert them (import), how many posts we talking about here?

tonyparra 02-22-2013 10:25 PM

Quote:

Originally Posted by fris (Post 19495137)
might be a plugin to convert them (import), how many posts we talking about here?

Its only like 50 ive tried a couple different plugins to no avail.

tonyparra 02-22-2013 10:33 PM

This plugin: http://wordpress.org/extend/plugins/get-the-image/ works great but i cant figuire how to intergrate it into this theme, my php is not that advanced :helpme i contacted the theme author for ideas and they told me to hire a coder ...

scouser 02-22-2013 11:17 PM

does calling

get_the_image()

not work? just do

<? echo get_the_image(); ?> from within the loop. does that not output ur pic?

Colmike9 02-22-2013 11:24 PM

Someone asked the author that question before and he said:
"Hey,

either change the way cooolzine displays the posts: lib/functions/cooolzine.php - cooolzine_toparticle() - cooolzine_boxarticle()

or have a look a the functionality of the post2media plugin which does the picture attachment.

Cheers"

Does this help?

buzzard 02-22-2013 11:37 PM

Make a csv file for your images and then import the csv,
you could also do an auto featured image import

just a punk 02-23-2013 01:21 AM

With CyberSEO you can do it as easy as this:
  1. go to CyberSEO->Tools;
  2. insert the following code into the "PHP Code <?php .. ?>" box:
    Code:

    $thumb = get_post_meta($post->ID, "YOUR_THUMBNAIL_CUSTOM_FIELD_NAME", true);
    cseo_attach_post_thumbnail($post->ID, $thumb, $post->post_title);

  3. click "Apply These Modifications To All Existing Posts".

:pimp

tonyparra 02-23-2013 09:26 AM

Quote:

Originally Posted by Colmike7 (Post 19496335)
Someone asked the author that question before and he said:
"Hey,

either change the way cooolzine displays the posts: lib/functions/cooolzine.php - cooolzine_toparticle() - cooolzine_boxarticle()

or have a look a the functionality of the post2media plugin which does the picture attachment.

Cheers"

Does this help?

It does i didnt see that comment, I tried to insert get_the_image in the loop, lol i guess you may have saw my snarky comments too, maybe i was a bit rude to the guy but i was irritated by that point. But Since i like the design so much i think i will just attempt to change the entire way the loop works and make it more like regular wp.

tonyparra 02-23-2013 09:57 AM

Quote:

Originally Posted by CyberSEO (Post 19496397)
With CyberSEO you can do it as easy as this:
  1. go to CyberSEO->Tools;
  2. insert the following code into the "PHP Code <?php .. ?>" box:
    Code:

    $thumb = get_post_meta($post->ID, "YOUR_THUMBNAIL_CUSTOM_FIELD_NAME", true);
    cseo_attach_post_thumbnail($post->ID, $thumb, $post->post_title);

  3. click "Apply These Modifications To All Existing Posts".

:pimp

:bowdown man i keep forgetting about this tools section on cyberseo, considering the site i get most traffic on uses cyberseo, i should it on everything for something like this at least

tfs 02-23-2013 02:36 PM

This is placeholder so I don't forget...

I've been using Wordpress since 2005 and - up until recently - I had been using TimThumb and/or custom fields to generate thumbnails.

With the "new" Wordpress, I switched all my themes to show "Featured Images" and - of course - all my thumbnails disappeared.

I have a script/function that will pull any image from any post and display it as a featured image or thumbnail on your homepage (if the post has an image, that is). It also has bootstrap capability that pulls images and posts to your front page like Facebook ot Pinterest and makes your homepage an never ending wall of posts.

I have been meaning to seperate the funcionalitly for awile. Maybe I will give it a shot this weekend.

It works like this theme (Ipin?), but a lot better: http://www.feedmeamateurs.com/

just a punk 02-24-2013 01:57 AM

Quote:

Originally Posted by tonyparra (Post 19496687)
:bowdown man i keep forgetting about this tools section on cyberseo, considering the site i get most traffic on uses cyberseo, i should it on everything for something like this at least

You're welcome :)


All times are GMT -7. The time now is 04:13 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123