The MU forums have moved to WordPress.org

Adding content to default page (9 posts)

  1. denzel2364
    Member
    Posted 14 years ago #

    Hi there,

    To add a default page i duplicate this code

    $wpdb->insert( $wpdb->posts, array(
    		'post_author' => $user_id,
    		'post_date' => $now,
    		'post_date_gmt' => $now_gmt,
    		'post_content' => #CONTENT GOES HERE#,
    		'post_excerpt' => '',
    		'post_title' => __('Portfolio'),
    		'post_name' => __('portfolio'),
    		'post_modified' => $now,
    		'post_modified_gmt' => $now_gmt,
    		'post_status' => 'publish',
    		'post_type' => 'page',
    		'to_ping' => '',
    		'pinged' => '',
    		'post_content_filtered' => ''
    	) );

    In replace of CONTENT GOES HERE i need to add the following:

    <?php
    if ( $user_ID<10 ) {
    //if (is_home() ) {
    
    			echo "";
    			_wp_menu_output( $menu, $submenu );
    do_action( 'adminmenu' );
    			echo "";
     }
    else {
    			echo "menu-header.php";
    }
    ?>
    </ul>

    Now could you help me? Please?

  2. denzel2364
    Member
    Posted 14 years ago #

    Tried adding:
    $subscription_portfolio = include("../subscription_portfolio.php");

    'post_content' => $subscription_portfolio,

  3. denzel2364
    Member
    Posted 14 years ago #

    i would quite like to use the php include if that works. It means i can then add quite a lot more options

  4. andrea_r
    Moderator
    Posted 14 years ago #

    Why are you inlcuding that php within the content of a new page? Shouldn't it be in the page template itself?

    "content goes here" refers to the actual post content displayed. The code you're adding looks like a menu.

  5. denzel2364
    Member
    Posted 14 years ago #

    Apologies, it was more about the if statement.

    WPMUDev have made a subscription plugin that only asks the user for payment when you login into the admin section. Therefore, i need to say on the specified page

    If subscriber then show. As apposed to if logged in

  6. denzel2364
    Member
    Posted 14 years ago #

    But i cant add the php into the '' so i thought about adding an include file

  7. andrea_r
    Moderator
    Posted 14 years ago #

    In the admin area, under Site Admin -> Option, there's a text box there to show the content of the default.

    Put your instructions in there, no php. You can't say only show it to subscribers because they haven't paid yet. :)

  8. denzel2364
    Member
    Posted 14 years ago #

    The reason why I am editing the core file is because I want to add Additional pages. Not just one. Therefore, you solution won't work. I wanted it to show only to subscriber so it has to be in php format.

    Do we conclude then That this can't subject be done

  9. andrea_r
    Moderator
    Posted 14 years ago #

    "The reason why I am editing the core file is because I want to add Additional pages."

    there are plugins to add additional pages for new blog creation.

    "I wanted it to show only to subscriber so it has to be in php format."

    Then change the blog's privacy. there's a plugin to show the whole blog to users only.

    "Do we conclude then That this can't subject be done "
    yes it can be done, you're just going about it the wrong way. :)

About this Topic

  • Started 14 years ago by denzel2364
  • Latest reply from andrea_r