Supplybrary
Forum Replies Created
-
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Custom fields aren't editable.I used code similar to this for each section needed to edit.
<?php function my_custom_field_escaping7( $content, $post_id, $key ) { if ( '_simple_fields_fieldGroupID_1_fieldID_7_numInSet_0' == $key ) return stripslashes( $content ); return $content; } add_filter( 'post_meta', 'my_custom_field_escaping7', 10, 3 ); ?> <div id="who"> <h3>Parts</h3> <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_7_numInSet_0', 'textarea'); ?> </div>
You will have to find the row name in the database for the section you want to edit. i found ours in wp_postmeta.
Forum: Fixing WordPress
In reply to: How do I bulk change the post_date?With some help from ssmusoke at StackOverflow and the MySQL manual. I have a SQL command that will re sequence all the post dates.
[sql]UPDATE wp_posts SET post_date = DATE_ADD(post_date,INTERVAL id SECOND)[/sql]
That takes the post ID and applies it to the seconds of the post date.
From other comments, I may have to also update post_date_gmt and the modified date columns.
Anyone know of issues with post_date and post_date_gmt not matching?
Forum: Fixing WordPress
In reply to: How do I bulk change the post_date?I’m still not there. I did learn how to foobar all the posts. DO NOT TRY THIS AT HOME.
UPDATE wp_posts SET post_date = '2012-02-18 01:47:50.000'
That code sets all the dates the same and wipes out all page links. So don’t try it.
I’m looking at this currently.
DECLARE @Date DATETIME SET @Date = '2012-02-18 01:47:50' UPDATE wp_posts SET post_date = ( @Date := @Date +1 )
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DECLARE @date DATETIME
SET @date = ‘2012-02-18 01:47:50’
UPDATE wp_posts SET p’ at line 1Any clues?
Forum: Fixing WordPress
In reply to: How do I bulk change the post_date?Thank you for the lead. I was able to make that work for one entry by including the whole time stamp like this.
[sql]UPDATE wp_posts SET post_date = REPLACE (post_date, ‘2011-05-28 02:11:16’, ‘2012-02-26 07:02:56’)[/sql]
It was still one row at a time, so i kept looking and pieced together this.
DECLARE @start datetime DECLARE @end datetime SELECT @start = '2012-02-18 01:47:50', @end = '2012-02-26 07:02:56' WHILE @start <= @end begin REPLACE wp_posts(post_date) VALUES(@start) SET @start = @start + 1 END
That doesn’t work. Has an error.
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘DECLARE @start datetime
DECLARE @end datetimeSELECT @start = ‘2012-02-18 01’ at line 1
So i looked at the manual, and found interesting functions.
DATE_ADD and TIMESTAMPADD. I’m still looking into it. Thanks again.
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Custom fields aren't editable.For now, I have just repeated the escape code, adding version numbers, like this.
<?php function my_custom_field_escaping( $content, $post_id, $key ) { if ( '_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0' == $key ) return stripslashes( $content ); return $content; } add_filter( 'post_meta', 'my_custom_field_escaping', 10, 3 ); ?> <?php function my_custom_field_escaping2( $content, $post_id, $key ) { if ( '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0' == $key ) return stripslashes( $content ); return $content; } add_filter( 'post_meta', 'my_custom_field_escaping2', 10, 3 ); ?>
etc…
Until I hear otherwise, I’ll go with that as the best solution.
Great plugin.
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Custom fields aren't editable.I was able to get one of the Simple Fields to show up. I went into the database under wp_postmeta and found the Simple Fields variable.
_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0
I then added that to my Front End Editor line of code like this
<?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'textarea'); ?>
I put that in my single.php theme file right under content like this
<?php the_content(); ?> <div> <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'textarea'); ?> </div>
that didn’t fully work so I added the escape code from scribu’s link like this
<?php the_content(); ?> <?php function my_custom_field_escaping( $content, $post_id, $key ) { if ( '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0' == $key ) return stripslashes( $content ); return $content; } add_filter( 'post_meta', 'my_custom_field_escaping', 10, 3 ); ?> <div> <?php editable_post_meta( get_the_ID(), '_simple_fields_fieldGroupID_1_fieldID_2_numInSet_0', 'textarea'); ?> </div>
Now it works great.
…butHow do I escape more that one Simple Fields variable?
_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0 _simple_fields_fieldGroupID_1_fieldID_2_numInSet_0 _simple_fields_fieldGroupID_1_fieldID_3_numInSet_0 _simple_fields_fieldGroupID_1_fieldID_4_numInSet_0 _simple_fields_fieldGroupID_1_fieldID_5_numInSet_0
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Custom fields aren't editable.Kahil,
What edits did you make in Front End Editor to get it to work? I’m using Simple Fields, with some issues. Any clues would be appreciated.
Forum: Requests and Feedback
In reply to: Add video as easy as image. Click on Image to make full size.I was able to change the ‘mediaspace’ id on the fly with this.
function getCustomField() { global $post; $video = js_escape(get_post_meta($post->ID, 'video', true)); $vid_place = js_escape(wp_get_attachment_url($video)); if($video) : ?> <script type='text/javascript' src='https://actual/path/to/swfobject.js'></script> <p><div id='<?php echo $video;?>'>This text will be replaced</div></p> <script type='text/javascript'> var so = new SWFObject('https://actual/path/to/player.swf','ply','470','320','9','#ffffff'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','transparent'); so.addVariable('file','<?php echo $vid_place;?>'); so.write('<?php echo $video;?>'); </script> <?php endif; }
Forum: Themes and Templates
In reply to: XML Flash banner problemsThis works to get the path to a video file. It might work for the XML.
function getCustomField() { global $post; $video = js_escape(get_post_meta($post->ID, 'video', true)); $vid_place = js_escape(wp_get_attachment_url($video)); if($video) : ?> <script type='text/javascript' src='https://actual/path/to/swfobject.js'></script> <p><div id='<?php echo $video;?>'>This text will be replaced</div></p> <script type='text/javascript'> var so = new SWFObject('https://actual/path/to/player.swf','ply','470','320','9','#ffffff'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','transparent'); so.addVariable('file','<?php echo $vid_place;?>'); so.write('<?php echo $video;?>'); </script> <?php endif; }
Forum: Fixing WordPress
In reply to: Putting flash mp3 player in a blog post.This works for videos. Might work for mp3s.
function getCustomField() { global $post; $video = js_escape(get_post_meta($post->ID, 'video', true)); $vid_place = js_escape(wp_get_attachment_url($video)); if($video) : ?> <script type='text/javascript' src='https://actual/path/to/swfobject.js'></script> <p><div id='<?php echo $video;?>'>This text will be replaced</div></p> <script type='text/javascript'> var so = new SWFObject('https://actual/path/to/player.swf','ply','470','320','9','#ffffff'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','transparent'); so.addVariable('file','<?php echo $vid_place;?>'); so.write('<?php echo $video;?>'); </script> <?php endif; }
Forum: Themes and Templates
In reply to: Javascript in if-else function not workingHey, mine works now. I just needed to add the full URLs.
function getCustomField() { global $post; $video = js_escape(get_post_meta($post->ID, 'video', true)); $vid_place = js_escape(wp_get_attachment_url($video)); if($video) : ?> <script type='text/javascript' src='https://actual/path/to/swfobject.js'></script> <p><div id='<?php echo $video;?>'>This text will be replaced</div></p> <script type='text/javascript'> var so = new SWFObject('https://actual/path/to/player.swf','ply','470','320','9','#ffffff'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','transparent'); so.addVariable('file','<?php echo $vid_place;?>'); so.write('<?php echo $video;?>'); </script> <?php endif; }
I got the hint from this post.
Forum: Themes and Templates
In reply to: Javascript in if-else function not workingdiederik.meijer,
Were you able to get this to work? I’m trying the same thing. If so, will you give an example?