• Is there any way to call the Camptix plugin shortcode in the template instead of its own page.
    Like this…
    echo do_shortcode('[camptix]');

    Currently I am getting the
    “An error has occurred.”
    as the output.
    I commented out this but it didn’t help

    /*if ( ! is_page() || ! stristr( $post->post_content, '[camptix' ) )
    			return;*/

    Thanks for any help.

    https://wordpress.org/plugins/camptix/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Ian Dunn

    (@iandunn)

    I confirmed this is a bug, but don’t have an ETA on when it will be fixed.

    https://github.com/Automattic/camptix/issues/120

    Anonymous User

    (@anonymized-1391468)

    I don’t know the CampTix plugin intimately, but have been working on integration with my plugin.

    Would something like the following replacement for shortcode_callback be a reasonable approach to support do_shortcode?

    function shortcode_callback( $atts, $content, $tag) {
    
    	if ( ! $this->did_template_redirect ) {
    			//$this->log( 'Something is seriously wrong, did_template_redirect is false.', 0, null, 'critical' );
    			//return __( 'An error has occurred.', 'camptix' );
    			global $post;
    			$args = '';
    			$sep = ' ';
    			foreach ($atts as $key => $value) {
    				$args = $sep . $key . '="' . $value . '"';
    				$sep = ', ';
    			}
    			$post->post_content = '[' . $tag . $args . ']';
    			$this->template_redirect();
    		}
    
    		wp_enqueue_script( 'camptix' ); // js in footer
    		return $this->shortcode_contents;
    	}
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Instantiate [camptix] shortcode in php code not new page’ is closed to new replies.