Anthony Acosta
Forum Replies Created
-
Forum: Plugins
In reply to: Trying to check if a condition is true, skip the functionThanks.
It worked.
However it turns out that its not returning what I need.How do I check if there is a “featured image” attached to a post?
I’ve tried
global $post; global $wpdb; $attached_file_check = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1"); if( get_post_meta($post->ID, "_videoembed", true) && !isset($attached_file_check) ) { //function to attach existing videothumbnail goes here }
It keeps firing the function leading to thousands of entries in my database to same thumbnails.
I am going to paste the entire function below, just in case you see other errors in my code.
function postmeta_img_fromvideo() { global $post; global $wpdb; $attached_file_check = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1"); //if(get_post_meta($post->ID, "_videoembed", true) AND get_post_meta($post->ID, "_thumbnail_id", true) != true) if( get_post_meta($post->ID, "_videoembed", true) && !isset($attached_file_check) ) { $videofilename = get_post_meta($post->ID, "_videoembed", true); $vid_sub_ext = substr($videofilename, 0 , -4); $thumb = $vid_sub_ext . '_1.jpg'; $thumbnail = str_replace('https://www.mydomainname.com/wp-content/', '', $thumb); $wp_filetype = wp_check_filetype(basename($thumbnail), null ); $attachment = array( 'post_mime_type' => $wp_filetype['type'], 'post_title' => get_the_title(), 'post_content' => 'Image for '.get_the_title(), 'post_status' => 'inherit' ); wp_insert_attachment($attachment, $thumbnail, $post->ID); // Get Attachment ID for Post $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1"); // Attached Image as Featured Thumbnail in Post update_post_meta($post->ID, "_thumbnail_id", $attachment_id); } } add_action('the_post','postmeta_img_fromvideo');
Thanks again for your help. I’m trying to automate this stuff as much as possible.
Forum: Plugins
In reply to: [Plugin: WP-Text-Sizer] Suggestion: add a reset button and contrast settingsThose are some great ideas. I agree with you.
Lemme work on upgrading the plugin to incorporate those options.Thanks
Forum: Plugins
In reply to: [Plugin: WP-Text-Sizer] syntax error with wp v2.9.2I have tried to reproduce the error in a 2.9.2 installation and have been unable to replicate it.
Is it possible that not ALL the files from the WP installation transferred?
Best way to troubleshoot this one would be to delete the plugin. If everything works then its the plugin, if not then the problem lies elsewhere.
I’ll monitor this thread for any developments.
Thanks John for emailing me.
Forum: Plugins
In reply to: Mailpress Bugshave you had any luck with this issue?
Forum: Installing WordPress
In reply to: Permalinks work in Firefox but 404 in Explorer – (apache server)I’m having the same issue on one of my sites, did you find a solution?
Forum: Plugins
In reply to: [Plugin: Events Calendar] Next/prev month links not showingI’m having the same issue, any help would be appreciated.
Forum: Plugins
In reply to: [Plugin: WP-Text-Sizer] Missing images of A and A-For some reason the images in the trunk folder of the repository didn’t make it into the download. I’ve re-uploaded them and it should be fixed on the next refresh.
Forum: Plugins
In reply to: [Plugin: WP-Text-Sizer] Suggestion: that the title texts be user configurableGreat idea, I’ll add it to my todo list for this plugin.
thanks.
Forum: Fixing WordPress
In reply to: Plugin API HTTP Error“An Unexpected HTTP Error occured during the API request”
Very annoying, don’t have a clue how to troubleshoot this one.
Forum: Plugins
In reply to: New Podcast Plugin! (PodPress Replacement)I’ve successfully updated 2 sites to WP2.7 with Podpress and have not had any issues with it.
I’m very happy with this combo, and for now I’m sticking with podpress
Forum: Your WordPress
In reply to: Local Fox News Affiliate website powered by wordpressQuick update,
I added 5px padding on the story content on both the left and right hand sides. I’ve been trying to minimize the dominance of the left sidebar( With limited success). And now I’m trying to figure out the correct text size range for the sidebar stories.
We have a large “Winter Texan” population which frequents this website. They are generally older, which is why the text is a bit larger on the site. I used to have a toggle for the text size, but it proved itself to be a much larger hassle than it was worth.
Again, I really appreciate the feedback.
Forum: Your WordPress
In reply to: Local Fox News Affiliate website powered by wordpressThanks for your kind replys. I built it myself, it took about a week for the initial site to go up, and a couple of months of tweaking.
I was able to get the thumbnails working by using the plugin “Post Image”. To be able to show the thumbnails and preroll videos on podpress, I had to modify the player spawn code so that it would accept m4v’s for ipods.
Here is what I added to podpress.js around line 134
case 'm4v': if(strAutoStart == 'true') { strAutoStart = ''; } else { strAutoStart = '&autoStart=false'; } //begin experimental m4v //src="'+strMediaFile+'_1.jpg" //src="'+strMediaFile+'" filename = (strMediaFile.replace(/.m4v/i, "")); if(navigator.userAgent.match(/mac/i)){ strResult = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320px" height="240px" codebase="https://www.apple.com/qtactivex/qtplugin.cab">'; strResult += ' <param name="src" value="'+filename+'_1.jpg" />'; strResult += ' <param name="href" value="'+strMediaFile+'" />'; strResult += ' <param name="scale" value="1" />'; strResult += ' <param name="showlogo" value="false" />'; strResult += ' <param name="controller" value="true" />'; strResult += ' <param name="autoplay" value="'+strAutoStart+'" />'; strResult += ' <param name="bgcolor" value="000000" />'; strResult += ' <param name="pluginspage" value="https://www.apple.com/quicktime/download/" />'; strResult += ' <embed href="'+strMediaFile+'" width="320px" height="260px" scale="1" cache="true" bgcolor="000000" showlogo="false" autoplay="'+strAutoStart+'" controller="true" src="'+filename+'_1.jpg" type="video/x-m4v" target="myself" pluginspage="https://www.apple.com/quicktime/download/"></embed>'; strResult += '</object><br /><br />'; } else { strResult = '<embed src="'+podPressBackendURL+'players/flvplayer.swf" width="320" height="260" author="FOX XRIO 2" allowfullscreen="true" allowscriptaccess="always" repeat="list" stretching="fill" image="='+filename+'_1.jpg" flashvars="&controlbar=bottom&fullscreen=true&stretching=fill&repeat=list&file='+podPressBackendURL+'playlistm4v'+(Math.floor(Math.random()*3)+1)+'.php?filename='+filename+'&image='+filename+'_1.jpg" />'; } //end experimental m4v break;
As you can see from the code, the thumbnails must have the same name as the video file.
In order to get the prerolls to work, I created files called playlist1.php playlist2.php and playlist3.php (one for each preroll) I manually alter these to fit the individual prerolls that I want to run. Here is the sample code for one of these.
playlist1.php
<?php $filename = (isset($_GET['filename'])) ? strval($_GET['filename']):'117'; $previewimage = ($_GET['filename']) ? strval($_GET['filename']):'117'; if (strpos($filename, '.flv') === false) {$filename = $filename . '.flv';} $filename = trim(''. $filename); $year = substr($filename, 0, 4); // returns the year $month = substr($filename, 4, 2); // returns the month //if (strpos($previewimage, '_1.jpg') === false) $previewimage1 = $previewimage . '_1.jpg'; $previewimage2 = trim(''. $previewimage1); header("content-type:text/xml;charset=utf-8"); print <<<END <?xml version="1.0" encoding="UTF-8"?> <playlist version="1" xmlns="https://xspf.org/ns/0/"> <title>Standard Playlist</title> <info>https://www.foxrio2.com</info> <annotation>Standard Playlist</annotation> <trackList> <track> <title>Preroll</title> <image>$previewimage2</image> <location>https://www.foxrio2.com/images/drhospital.flv</location> <info>https://www.dhr-rgv.com/home.htm</info> <album>preroll</album> <type>video</type> </track> <track> <title>FOX Rio 2</title> <image>$previewimage2</image> <location>$filename</location> <type>video</type> </track> </trackList> </playlist> END; ?>
I hope this information helps.
Forum: Plugins
In reply to: New Podcast Plugin! (PodPress Replacement)Podpress has been great. I would love to know if anyone has had any trouble making it work with 2.7? I’m running it on 2.6.3 right now and I’m not experiencing any problems. However these are live sites, and I don’t want to mess them up with an upgrade that will break it.
Forum: Your WordPress
In reply to: Local Fox News Affiliate website powered by wordpressThanks for the feedback.
I’ve updated the font to lucida, tahoma, arial, and have maintained the headlines in times roman. I’ve tried to separate the right sidebar from the content using a thin line. There’s not alot of room there, unfortunately.
As far as the footer. Its hard to change that without killing it completely in one of the other browsers. I’ve tested this theme on chrome, firefox, ie7 and ie6 as well as safari.
Seriously though, thanks for taking the time to critic it. I really appreciate it.
Forum: Plugins
In reply to: Toggle posts visible or hiddenHere is the BROKEN code that I was hoping someone could help me fix.
<script type="text/javascript"> states=new Array() <?php $my_query1 = new wp_query1('showposts=10'); ?> <?php $i = 1; ?> <?php while ($my_query1->have_posts()) : $my_query1->the_post(); ?> states['<?php $i=$i+1; ?>']="<?php the_ID(); ?>" <?php endwhile; ?> <?php endif; ?> function hideAllExcept(elm) { for (var i = 0; i < states.length; i++) { var layer = document.getElementById(states[i]); if (elm!= states[i]) { layer.style.display = "none"; } else { layer.style.display = "block"; } } } </script>
And then to list the stories with toggles, I use this code.
<ul style="list-style-type:none;display: inline;"> <?php $my_query = new wp_query('showposts=10'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <style> div#commentForm<?php the_ID(); ?> { margin: 10px 20px 0px 20px; display: none; } </style> <li><a href="#" onclick="hideAllExcept(this.<?php the_ID(); ?>);" rel="bookmark" class="headlines" title="<?php the_title(); ?>"><img src="<?php post_image('/videopreview.jpg', false, false); ?>" width="50px" alt="<?php the_title(); ?>" border=0 name="<?php the_title(); ?>" /></a></li> <?php endwhile; ?> </ul>