Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter website designer

    (@jessicamureenn)

    I saw the solution below, how do I apply it to my code post-form.php?

    ob_start();

    then after your form add:
    $form = ob_get_clean();
    echo do_shortcode(‘[IN_LIMIT] ‘ .$form. ‘ [/IN_LIMIT]’);

    My code:

    <?php
    /**
     * Front-end post form.
     *
     * @package P2
     */
    ?>
    <script type="text/javascript">
    /* <![CDATA[ */
    	jQuery(document).ready(function($) {
    		$('#post_format').val($('#post-types a.selected').attr('id'));
    		$('#post-types a').click(function(e) {
    			$('.post-input').hide();
    			$('#post-types a').removeClass('selected');
    			$(this).addClass('selected');
    			if ($(this).attr('id') == 'post') {
    				$('#posttitle').val("<?php echo esc_js( __('Post Title', 'p2') ); ?>");
    			} else {
    				$('#posttitle').val('');
    			}
    			$('#postbox-type-' + $(this).attr('id')).show();
    			$('#post_format').val($(this).attr('id'));
    			return false;
    		});
    	});
    /* ]]> */
    </script>
    
    <?php $post_format = isset( $_GET['p'] ) ? $_GET['p'] : 'status'; ?>
    <div id="postbox">
    
    	<div class="postboxcontent">
    <ul id="post-types">
    	<b><a id="post" class="post-format-button<?php if ( 'post' == $post_format || 'standard' == $post_format ) : ?> selected<?php endif; ?>" href="<?php echo site_url( '?p=post' ); ?>" title="<?php esc_attr_e( 'Currently Viewing all Network Posts', 'p2' ); ?>"><i class="fa fa-eye"></i> <?php _e( 'Currently Viewing all Network Posts', 'p2' ); ?></a></b>
    		</ul>
    		<div class="avatar">
    			<?php echo get_avatar( get_current_user_id(), 240 ); ?>
    		</div>
    
    		<div class="inputarea">
    ob_start();
    			<form id="new_post" name="new_post" method="post" action="<?php echo site_url(); ?>/">
    				<?php if ( 'status' == $post_format || empty( $post_format ) ) : ?>
    				<label for="posttext" id="post-prompt">
    					<center><?php p2_user_prompt(); ?><br><br><hr><img src="https://caldr.com/wp-content/uploads/2015/12/click-to-post.png"></center>
    				</label>
    				<?php endif; ?>
    				<div class="inputs">
    <?php if ( current_user_can( 'upload_files' ) ): ?>
    				<div id="media-buttons" class="hide-if-no-js">
    					<br><?php p2_media_buttons(); ?>
    				</div>
    				<?php endif; ?>
    
    <input type="text" name="posttitle" id="posttitle" value="Post Title"
    						onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Post Title', 'p2' ) ); ?>') ? '' : this.value;"
    						onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Post Title', 'p2' ) ); ?>' : this.value;" />
    
    					<textarea class="expand70-200" name="posttext" id="posttext" rows="4" cols="60"></textarea>
    
    					<label class="post-error" for="posttext" id="posttext_error"></label>
    					<div class="postrow">
    						<input id="tags" name="tags" type="text" autocomplete="off"
    							value="<?php esc_attr_e( 'Tag it', 'p2' ); ?>"
    							onfocus="this.value=(this.value=='<?php echo esc_js( __( 'Tag it', 'p2' ) ); ?>') ? '' : this.value;"
    							onblur="this.value=(this.value=='') ? '<?php echo esc_js( __( 'Tag it', 'p2' ) ); ?>' : this.value;" />
    						<input id="submit" type="submit" value="<?php esc_attr_e( 'Post it', 'p2' ); ?>" />
    					</div>
    					<input type="hidden" name="post_format" id="post_format" value="<?php echo esc_attr( $post_format ); ?>" />
    					<span class="progress spinner-post-new" id="ajaxActivity"></span>
    
    					<?php do_action( 'p2_post_form' ); ?>
    
    					<input type="hidden" name="action" value="post" />
    					<?php wp_nonce_field( 'new-post' ); ?>
    				</div>*Html Allowed. Articles should be 100% original, no plr.<br>Your post is autoshared to 47,000 (and Growing) subscribers and followers in our network!
    			</form>
    $form = ob_get_clean();
    echo do_shortcode('[IN_LIMIT] ' .$form. ' [/IN_LIMIT]');
    
    		</div>
    
    		<div class="clear"></div>
    
    		<div class="postbox-sidebar">
    			<?php dynamic_sidebar( 'beneath-post-box' ); ?>
    		</div>
    
    	</div><!--/.postboxcontent -->
    
    </div> <!-- // postbox -->

    Thread Starter website designer

    (@jessicamureenn)

    I saw the solution below, how do I apply it to my code post-form.php, view here https://pastebin.com/jujv51uM

    ob_start();
    
    then after your form add:
    $form = ob_get_clean();
    echo do_shortcode('[IN_LIMIT] ' .$form. ' [/IN_LIMIT]');
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Works with P2 theme?’ is closed to new replies.