Support » Theme: P2 » [Theme: P2] media button – frontend

  • Hello all.

    I’m curious if someone can shed some light. I’m trying to add the same media upload button similar to the p2theme but in my theme. I’ve added,

    function p2_media_buttons() {
    	// If we're using http and the admin is forced to https, bail.
    	if ( ! is_ssl() && ( force_ssl_admin() || get_user_option( 'use_ssl' ) )  ) {
    		return;
    	}
    	include_once( ABSPATH . '/wp-admin/includes/media.php' );
    	ob_start();
    	do_action( 'media_buttons' );
    	// Replace any relative paths to media-upload.php
    	echo preg_replace( '/([\'"])media-upload.php/', '${1}' . admin_url( 'media-upload.php' ), ob_get_clean() );
    }

    to my functions.php. I also added this,

    <div id="media-buttons" class="hide-if-no-js">
      <?php p2_media_buttons(); ?>
    </div>

    to where I have my post form in the front end. I’m not getting errors, but the media window isn’t popping up.

    Your help is very much appreciated!

    Thanks,
    -John

    http://wordpress.org/extend/themes/p2/

Viewing 5 replies - 1 through 5 (of 5 total)
  • No one can help me?

    it would help if you could elaborate on your question, it sounds very ambiguous without further details and without a link to your site. I can’t make out what theme you are using? How is your frontend post form generated? Is it based on the p2 theme?

    i want to use my own theme, a customized theme; however I would like to add a feature to it like the p2 theme, the ability to have the upload media capabilities in the front end-they used the backends media upload functionality. the code above is what p2 theme uses, but again, i’m not sure how they got it to work.

    thanks. i hope i was clearer there.

    I see. The P2 function you tried is not going to work in isolation. Is it only a file upload that you want? Have you tried a dedicated plugin like http://wordpress.org/extend/plugins/front-end-upload/?

    If you also want a complete post form, I’d do something with wp_editor() function which lets you add the tinymce editor on the front-end with upload button included.

    Yeah, it is the only file upload capabilities that I want. I looked into the plugins, but I’d like it to be packaged with the theme.

    I’ll definitely look into the wp_editor; thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Theme: P2] media button – frontend’ is closed to new replies.