Elite Authors dtbaker Answers Your Questions (video)

Dave and Hayley are known as ‘dtbaker’, Envato Elite Authors who have sold thousands of plugins and website templates on Envato Market.

They’ve just sold their house and decided to hit the road in a campervan to travel around Australia. Josh and Naysan visited them on the Gold Coast, Australia, to film them for an upcoming #EnvatoStories episode.

This is a short clip of dtbaker answering questions from the Envato forums.

facebook

Create your own WordPress TinyMCE view and shortcode popup editor

Here is the code:

https://github.com/dtbaker/wordpress-mce-view-and-shortcode-editor

This code converts a plain WordPress shortcode (like below:)

\\

.into a nice custom MCE view that matches the frontend (like below)

\\

.and lets you click on it ( same as wordpress galleries ):

\\

and click the edit button to change shortcode params:

\\

it also adds a button so you can easily create the shortcode without typing the code

\\

Change the default WordPress gallery MCE view

The default WordPress gallery MCE view is from media-template.php and looks like this:

<script type="text/html" id="tmpl-editor-gallery">
   <# if ( data.attachments ) { #>
      <div class="gallery gallery-columns-{{ data.columns }}">
         <# _.each( data.attachments, function( attachment, index ) { #>
            <dl class="gallery-item">
               <dt class="gallery-icon">
                  <# if ( attachment.thumbnail ) { #>
                     <img src="{{ attachment.thumbnail.url }}" width="{{ attachment.thumbnail.width }}" height="{{ attachment.thumbnail.height }}" />
                  <# } else { #>
                     <img src="{{ attachment.url }}" />
                  <# } #>
               </dt>
               <# if ( attachment.caption ) { #>
                  <dd class="wp-caption-text gallery-caption">
                     {{ attachment.caption }}
                  </dd>
               <# } #>
            </dl>
            <# if ( index % data.columns === data.columns - 1 ) { #>
               <br style="clear: both;">
            <# } #>
         <# } ); #>
      </div>
   <# } else { #>
      <div class="wpview-error">
         <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p>
      </div>
   <# } #>
</script>

To change this default layout, create a new editor-gallery template and output it during admin_print_footer_scripts like this:

 

add_action( 'admin_print_footer_scripts', 'dtbaker_gallery_override' );
function dtbaker_gallery_override(){
   ?> 
   <script type="text/html" id="tmpl-editor-gallery-custom">
       your custom layout code here
   </script>
    <script type="text/javascript">
       ( function( $ ) {
          var media = wp.media;
          var galleryview = wp.mce.views.get('gallery');
          galleryview.View = galleryview.View.extend( {
            template: media.template( 'editor-gallery-custom' )
         } );
       })(jQuery);
    </script> 
   <?php 
}

you can even change the type of gallery based on shortcode attributes, like this:

add_action( 'admin_print_footer_scripts', 'dtbaker_gallery_override' );
function dtbaker_gallery_override(){
   ?> 
   <script type="text/html" id="tmpl-editor-gallery-custom">
       your custom layout code here
   </script>
    <script type="text/javascript">
( function( $ ) {
   var media = wp.media;
   var galleryview = wp.mce.views.get('gallery');
   galleryview.View = galleryview.View.extend( {
    initialize: function( options ) {
      this.shortcode = options.shortcode;
       // change the gallery tempalte depending on shortcode attributes, eg: [gallery slider="flexslider"]
       if(typeof this.shortcode.attrs.named.slider != 'undefined'){
          switch(this.shortcode.attrs.named.slider){
             case 'flexslider':
                this.template = media.template( 'editor-gallery-dtbaker-flexslider' );
                break;
             case 'pretty':
                this.template = media.template( 'editor-gallery-dtbaker-pretty' );
                break;
             default:
                // leave the existing template (editor-gallery)
           }
       }
      this.fetch();
   }
} );
  })(jQuery);
  </script>   <?php }

 

 

Great things that happened in 2014

100 Great Things That Happened at Envato Market in 2014

Ever since Collis announced back in August this year that our eight marketplaces would collectively be called Envato Market, I have been keeping track of everything that has been going on across all Envato sites and markets.

5 years and 2 babies later, David (dtbaker) shared a few great moments from his incredible journey with us.


Thank You from dtbaker

dtbaker familyCodeCanyon and ThemeForest have improved my life beyond imagination. I do not know where I would be without you guys (chained to a desk in a high rise cubical?).

It has (and continues) to be an amazing ride, ever since making that very first sale on the 18th of June 2009. I will never forget the $2 I made off that first $5 sale – I knew something big was starting.

Over the years I have seen a mind blowing number of changes, new features and improvements. I can only imagine what else has gone on behind the scenes.

Putting together a quick list of some memorable moments and things that have been made possible by selling on the marketplaces:

  • When the author rates were increased from 40%-70% to 50%-70%, and also made a lot more achievable. (here’s a history for those who don’t know)
  • Celebrating the Gold Paw (this was back when YAY threads were cool)
  • When CodeCanyon split from ThemeForest
  • Becomming a volunteer moderator
  • Receiving surprise Envato swag in the mail
  • Getting new badges (I really think this is the most exciting thing ever haha – maybe I’m a little weird)
  • Getting engaged and married
  • Building cool gadgets based on the Envato API: (I have another one in the works)
  • Travelling around Australia and working from a caravan
  • Having two kids (I wonder how many babies have been made possible with Envato?)
  • Working from home close to my family
  • And of course the handful of forum members who have made my life entertaining (yes working from home sometimes the forums are the only social life I get – I should get out more)

So just to sum up, you guys and girls rock. Try to look past the recent forum negativity and keep going strong.

When I ever get back down to Melbourne I’ll come say hi and thank you in person :)

gold paw

Yet Another I Got A Gold Paw Thread :)

Thanks Envato, and thanks to all our buyers!

(don’t need to re-mention everything from our recent Wow – what a year! thread, but we just got the gold paw!)

1 year and 20 days we’ve achieved a bit:

  • from 40% to 53% commission rate.
  • 1 gold ”$50000” paw.
  • about ~$24000US income from that.

Had a bit of a celebration last night when we ticked over to the 50k mark. This was the most forum friendly photo.

Now to release some more new items and old updates! Aiming for the next paw by this time next year.

Rich Text/Visual/WYSIWYG Editor does not work in WordPress behind cloudfront

WordPress decides if the Rich Text / Visual editor should display based on the browser user agent.

Unfortunately if you host WordPress behind cloudfront then WordPress will only see the “CloudFront” user agent. It will disable the visual editor and cause a bunch of issues.

The quickest way to enable the visual editor again is to add this to your theme functions.php file:

function dtbaker_wp_cloudfront(){
    add_filter('user_can_richedit','__return_true');
}
add_action( 'init', 'dtbaker_wp_cloudfront' , 9 );

ffmpeg: How to speed up video AND audio.

You need ffmpeg version 2.x – download from here if you don’t have it: http://johnvansickle.com/ffmpeg/ or compile the latest version from source: http://trac.ffmpeg.org/wiki/CompilationGuide

Here’s a script I use to resize my GoPro videos and speed them up by 4 times:

The max value for ‘atempo’ is 2, so you have to string two of them together in order to get 4 times speed increase.

BITRATE=7000k
SIZE=960x540
SOURCE=back/
DEST=small/
FFMPEG=~/bin/ffmpeg-2.0.1-64bit-static/ffmpeg
for i in $SOURCE*.MP4; do
 echo "Processing $i";
 $FFMPEG -i $i -vcodec mpeg4 -vtag XVID -b:v $BITRATE -bf 2 -s $SIZE -pass 1 -passlogfile $i -an -threads 0 -f rawvideo -y /dev/null;
 #$FFMPEG -i $i -vcodec mpeg4 -vtag XVID -b:v $BITRATE -bf 2 -s $SIZE -vf setpts=0.15*PTS -pass 2 -passlogfile $i -an -threads 0 -f avi -y $DEST$i.avi;
 $FFMPEG -i $i -vcodec mpeg4 -vtag XVID -b:v $BITRATE -bf 2 -s $SIZE  -filter_complex "[0:v]setpts=0.125*PTS[v];[0:a]atempo=2.0,atempo=2.0,atempo=2.0[a]" -map "[v]" -map "[a]" -pass 2 -passlogfile $i -an -threads 0 -f avi -y $DEST$i.avi;
done;