Skip to:
Content
Pages
Categories
Search
Top
Bottom

Display Post Form through Shortcodes


  • tim458
    Participant

    @tim458

    Hi,

    I want to make the Activity Post Form accessible to WordPress pages using short codes.
    The reference to the post form can be found here: html/wp-content/plugins/buddyboss-platform/bp-templates/bp-nouveau/buddypress/activity/index.php

    Which contains this…

    <?php
    /**
     * The template for BuddyBoss Activity templates
     *
     * This template can be overridden by copying it to yourtheme/buddypress/activity/index.php.
     *
     * @since   BuddyPress 2.3.0
     * @version 1.0.0
     */
    
    ?>
    
    	<?php bp_nouveau_before_activity_directory_content(); ?>
    
    	<?php if ( is_user_logged_in() ) : ?>
    
    		<?php bp_get_template_part( 'activity/post-form' ); ?>
    
    	<?php endif; ?>
    	
    	
    
    	<?php bp_nouveau_template_notices(); ?>
    
    	<?php if ( ! bp_nouveau_is_object_nav_in_sidebar() ) : ?>
    
    		<?php bp_get_template_part( 'common/nav/directory-nav' ); ?>
    
    	<?php endif; ?>
    
    	<div class="screen-content">
    
    		<?php bp_get_template_part( 'common/search-and-filters-bar' ); ?>
    
    		<?php bp_nouveau_activity_hook( 'before_directory', 'list' ); ?>
    
    		<div id="activity-stream" class="activity" data-bp-list="activity">
    
    				<div id="bp-ajax-loader"><?php bp_nouveau_user_feedback( 'directory-activity-loading' ); ?></div>
    
    		</div><!-- .activity -->
    
    		<?php bp_nouveau_after_activity_directory_content(); ?>
    
    	</div><!-- // .screen-content -->

    I want to reuse the following code which can also be found in the file above:

    	<?php if ( is_user_logged_in() ) : ?>
    
    		<?php bp_get_template_part( 'activity/post-form' ); ?>
    
    	<?php endif; ?>

    So I created a short code in functions.php in the child theme, which I use to place in WordPress pages as a shortcode…

    function InsertPostForm() {
    	if ( is_user_logged_in() ) :
    		php bp_get_template_part( 'activity/post-form' );
    	endif;
    }
    add_shortcode('InsPostForm', 'InsertPostForm');

    However, my solution does not work. I am very desperately in need of a solution. Please note my knowledge of PHP is very limited.

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)

  • shanebp
    Moderator

    @shanebp

    > …wp-content/plugins/buddyboss-platform

    These are the forums for BuddyPress, not BuddyBoss.


    tim458
    Participant

    @tim458

    My bad, I thought they were essentially the same.
    But they do use the same core? So would you kindly be able to guide in solving this?


    shanebp
    Moderator

    @shanebp

    BuddyBoss is a fork of BuddyPress, done several years ago. The codes bases have diverged.


    tim458
    Participant

    @tim458

    Ok, new question:
    How could I display the Activity postform from Buddypress Nouveau as a shortcode using functions.php?

    Do I post this on a new topic?
    Thanks


    shanebp
    Moderator

    @shanebp

    Some names are the same but the underlying code is different.
    You need to ask BuddyBoss – they have a facebook page for questions.


    tim458
    Participant

    @tim458

    But now I wonder how it would be done on Buddypress.
    Could you guide me on that?
    Thank you!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar