Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Ryann Micua

    (@pogidude)

    In your functions.php file, add the following code:

    add_filter('mab_allowed_post_types', 'add_cpt_to_mab');
    add_cpt_to_mab($posttypes){
       $posttypes[] = 'your-post-type'; // slug of your custom post type
       // $posttypes[] = 'another-post-type'; //uncomment this line if you wish to add another post type
       return $posttypes;
    }
    Thread Starter sebfrey

    (@sebfrey)

    Thanks! That did the trick.

    ta_jonathan

    (@ta_jonathan)

    Wouldn’t you need to make that a function?
    Is it also possible to add magic action box popups to custom post types?

    I have tried but not found, it return a error:

    Parse error: syntax error, unexpected ‘{‘ in /home3/manuel/public_html/CursoWordpress/wp-content/plugins/magic-action-box/lib/functions.php on line 170

    Plugin Author Ryann Micua

    (@pogidude)

    you need to add it to your theme’s functions.php file. not on the plugin.

    and this is the correct code:

    add_filter('mab_allowed_post_types', 'add_cpt_to_mab');
    function add_cpt_to_mab($posttypes){
       $posttypes[] = 'your-post-type'; // slug of your custom post type
       // $posttypes[] = 'another-post-type'; //uncomment this line if you wish to add another post type
       return $posttypes;
    }

    Thanks!. It’s work, appear in the backend, but not in the fronted :-(.

    Plugin Author Ryann Micua

    (@pogidude)

    would you happen to know if the custom post type uses the_content() method to show the content? because MAB uses the the_content filter hook to “inject” the action boxes.

    Yes, It uses.

    <?php
    /**
     * @package Alpine
    */
    /*
    Template Name: One Page Template
    */
    
    get_header();
    ?>
        <?php if ( function_exists( 'ot_get_option' ) ):
          if(ot_get_option('menu_position') == 1):?>
          <div class="menu_first">
            <?php get_template_part( 'assets/php/partials/main', 'nav' ); ?>
          </div>
        <?php endif;endif;?>
    
        <?php if ( function_exists( 'ot_get_option' ) ):
          if(ot_get_option('enable_preloader') != 2):?>
          <div class="mask" <?php echo(ot_get_option('loader_bg')!= '') ? 'style="background:'.ot_get_option('loader_bg').'"':'' ?>>
            <div id="intro-loader" <?php echo(ot_get_option('loader_icon')!= '') ? 'style="background:url('.ot_get_option('loader_icon').');"':'' ?>></div>
          </div>
        <?php endif;endif;?>
    
        <section id="home" <?php echo(ot_get_option('menu_position')== 1) ? 'class="menu_top"':'' ?> >
          <?php the_content(); ?>
        </section>
    
        <?php if ( function_exists( 'ot_get_option' ) ):
          if(ot_get_option('menu_position') != 1):?>
          <?php get_template_part( 'assets/php/partials/main', 'nav' ); ?>
        <?php endif; endif;?>
    
    		<?php $the_query_onepage = new WP_Query( 'post_type=onepage&posts_per_page=50');?>
    		<?php if ($the_query_onepage->have_posts() ) : ?>
    			<?php while ($the_query_onepage->have_posts() ) : $the_query_onepage->the_post(); ?>
    				<?php get_template_part('assets/php/partials/content', 'page'); ?>
    			<?php endwhile; wp_reset_query();?>
    		<?php endif; ?> 
    
    <?php get_footer(); ?>

    Thanks.

    Plugin Author Ryann Micua

    (@pogidude)

    What is the name of the file you took this code from?

    Sorry for the last, the file names page_onepage.php

    My theme is a OnePage Theme, when it show sections one by one don’t appear, but in the onepage (alone) it show.

    Plugin Author Ryann Micua

    (@pogidude)

    A bit confused here. That doesn’t look like a template for a custom post type. This is the doc for custom post templates http://codex.wordpress.org/Post_Type_Templates

    Filename you described is a page template – for Pages.

    And yes the form should show for single page. Can you show me the page where action boxes don’t show?

    OK, don’t show, It show

    In the first you must go to “INCRíBETE YA” and go to the prices

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘MAB not appearing in custom post type’ is closed to new replies.