Forum Replies Created

Viewing 15 replies - 16 through 30 (of 33 total)
  • Thread Starter ferdri3

    (@ferdri3)

    resolved

    Thread Starter ferdri3

    (@ferdri3)

    ok so Ive looked at:
    page
    access
    body
    wrapper
    navigation

    and searched for:

    margin
    margin-top
    padding
    padding-top

    nothing came up.. so I added “top: -28px;” to body, but nothing happend.. after that I added “margin-top: -28px;” and finally it was on top.. BUT guess what, who is always the partypooper? IE! so fail again.

    PS. also tryed adding the -28 margin to access.. same result

    Thread Starter ferdri3

    (@ferdri3)

    its just the general TwentyTen 1.3 theme.
    I’m not allowed to open the website since its a project for a customer.

    I use Expression Web to edit, not firebug

    Thread Starter ferdri3

    (@ferdri3)

    The users are making it themselves.. they go to the main website and register to create their own site and add content themselves. There should be nothing I should do..

    Thread Starter ferdri3

    (@ferdri3)

    I know the options I give dont really makes use of WP’s full potential.

    The thing is that there are ideas for the future to make some options open again, hence the need of WP. Besides that, it needs to be low maintenance.
    So WP is actually the best option for this project. Everything is ready to go except for the page which needs to be created every time a new site is created. And as I said before, WP has this code somewhere because there are already pages created everytime a site gets made.

    Now I tryed to make the following code for functions.php but as I expected it doesnt work.. perhaps someone could help me with making this code work (debug it?)

    add_action('activate_blog','my_default_pages');
    
    function my_default_pages(){
        $default_pages = array('About','Home','My Store','My Address');
        $existing_pages = get_pages();
    
        foreach($existing_pages as $page){
            $temp[] = $page->post_title;
            }
    
        $pages_to_create = array_diff($default_pages,$temp);
    
        foreach($pages_to_create as $new_page_title){
    // Create post object
                $my_post = array();
                $my_post['post_title'] = $new_page_title;
                $my_post['post_content'] = 'This is my '.$new_page_title.' page.';
                $my_post['post_status'] = 'publish';
                $my_post['post_type'] = 'page';
    
                // Insert the post into the database
                $result = wp_insert_post( $my_post );
    
            }
            }

    I also tryed the hook: wp_head
    and the hook: wpmu_activate_blog

    Thread Starter ferdri3

    (@ferdri3)

    in that case there wont be sub-domains which is demanded.

    Im sure there is a way in functions.php for example to make a page by default. How else do the 2 example pages get created.

    The template isnt an issue anymore because I changed page.php so any new page should have the layout with widgets in them.

    I searched a little more and found this for functions.php:

    add_action('wpmu_new_blog', 'default_settings', 100, 2);
    function default_settings($blog_id, $user_id){
        switch_to_blog($blog_id);
    
        // setup your page here
    
        restore_current_blog();
    }

    and page setup should be something like this:

    $pages_to_create = array_diff($default_pages,$temp);
    foreach($pages_to_create as $new_page_title){ 
    
    // Create post object
    $my_post = array();
    $my_post['post_title'] = $new_page_title;
    $my_post['post_content'] = 'This is my '.$new_page_title.' page.';
    $my_post['post_status'] = 'publish'; $my_post['post_type'] = 'page';

    However, this goes a bit beyond my php knowledge and I have no clue how to get this work, IF it even works

    Thread Starter ferdri3

    (@ferdri3)

    My intention is to let people create their own 1 page site.
    (yoursite1.domainname.com for example)

    On this 1 page they get are widget area’s (now by selecting a template).
    But since they can add whatever to a page, I want to restrict access to the page-menu by hiding it. However, if I hide that menu, people cant create that 1 page right? And that “Example Page” they do get has a title + text in it AND it doesnt have the template selected (so the widget areas are not there).

    If it was the way I want it to be it would be like this:
    – Person makes a site.
    – Site automatically gives person a Page (not visible in the main-menu, since that is a sidewide menu).
    – Person fills in the widget area’s with widgets (since the Page has a template)

    The person does not see an example-blog-post and a example-page, just the 1 (custom) page I created with widget area’s.

    Thread Starter ferdri3

    (@ferdri3)

    Thanks Ipstenu!

    Both worked.. now the last thing I need is to automatically create a page.
    I was hoping this could be done in functions.php – Something like this:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    However, it doesnt work because of a “hook” but I dont know which one or how to edit this code.
    Also I would like to hide or delete the creation of a blogpost (which is visible everytime a new site is made)

    Thread Starter ferdri3

    (@ferdri3)

    ok, still having the same problem.
    sort-of fixed the plugin, but it doesnt do what I need it to do.

    Here again what I try to get:

    Every new registrated site should automatically get a default static page WITH a template (normally you can add a template on the right side while creating or editting a page). This template is already created and working.

    The reason I want this, is that the page is needed, but also because I want to disable the option forsite-admins to create any other pages.

    If there is any other way than messing with the core, Ill take it.. but if not, Ill take it aswell.

    All help is welcome! Thanks in advance!

    PS. normal page template is “page.php”.. how about replacing that with my own code? Or will that mess up a contact form page for example?

    Thread Starter ferdri3

    (@ferdri3)

    plugin doesnt work 🙁 doesnt show my pages/posts/tags/etc
    Code also doesnt work (unless I do it wrong lol)

    Thread Starter ferdri3

    (@ferdri3)

    Im not planning on updating WP in the future, so I should be ok with editting the core, but I understand why you are against it.

    Ill give that plugin a try, hoping that multisite hasnt changed to much since 3.0.1

    Thanks for the help! If it doesnt work, Ill try adding this:

    <?php
     update_post_meta($id, "_wp_page_template", "new_template.php");
    ?>

    Thread Starter ferdri3

    (@ferdri3)

    Hey Ipstenu,

    if you follow the link I provided, you see the same link somewhere there as what you just gave me. I understand that plugin just give the site-admins options (or removes them).

    To get a better view of what Im trying to create:
    When a new site-admin is registrated (which they can without permission) they get a website like “mysite.example.com”. If they visit that URL they get to see “Home” which displays a blog with 1 example post in it and an “About Me” Page.

    I removed some code in wp-admin/includes/upgrade.php to prevent the blog from being made by default. So now they only get the “About Me” Page after registrating. I also Editted some code in the same file which gives them another Page instead of “About Me”.

    Till now it all worked out. But I dont only want a replacement for “About Me”, I want to give that replacement a template (which can normally be set on the right) I created (yes the template works).

    So what Im guessing is that I need to change this code below to assign a template to it:

    // Second Page
    	$second_page = sprintf( __( "" ), admin_url() );
    	if ( is_multisite() )
    		$second_page = get_site_option( 'second_page', $second_page );
    	$second_post_guid = get_option('home') . '/?page_id=3';
    	$wpdb->insert( $wpdb->posts, array(
    								'post_author' => $user_id,
    								'post_date' => $now,
    								'post_date_gmt' => $now_gmt,
    								'post_content' => $second_page,
    								'post_excerpt' => '',
    								'post_title' => __( 'Home' ), // Shows in Menu bar
    								/* translators: Default page slug */
    								'post_name' => __( 'front-page' ), // URL -> example.com/'xxx'/
    								'post_modified' => $now,
    								'post_modified_gmt' => $now_gmt,
    								'guid' => $second_post_guid,
    								'post_type' => 'page',
    								'to_ping' => '',
    								'pinged' => '',
    								'post_content_filtered' => ''
    								));
    	$wpdb->insert( $wpdb->postmeta, array( 'post_id' => 3, 'meta_key' => '_wp_page_template', 'meta_value' => 'homepage.php' ) );

    The template name is “homepage.php” and I uploaded it to example.com/wp-content/themes/mytheme

    In the code above I tryed to add it on the bottom (without luck)
    Normally its:
    'meta_value' => 'default' ) );

    Thread Starter ferdri3

    (@ferdri3)

    (unable to edit previous post)

    I read
    http://wordpress.org/support/topic/add-multiple-pages-on-wp-multisite-by-default?replies=13
    just now and I understand how I can make static pages for each site.. now I need to know how to make 1 Page the default page on all sites.

    Forum: Fixing WordPress
    In reply to: Widgets show/hide
    Thread Starter ferdri3

    (@ferdri3)

    bumb

    Forum: Fixing WordPress
    In reply to: Widgets show/hide
    Thread Starter ferdri3

    (@ferdri3)

    extra info

    Custom page code: (4 times)

    <div class="row1">
    <!-- r01w01 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w01') ) : ?><?php endif; ?></div>
    <!-- r01w02 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w02') ) : ?><?php endif; ?></div>
    <!-- r01w03 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w03') ) : ?><?php endif; ?></div>
    <!-- r01w04 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w04') ) : ?><?php endif; ?></div>
    <!-- r01w05 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w05') ) : ?><?php endif; ?></div>
    <!-- r01w06 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w06') ) : ?><?php endif; ?></div>
    <!-- r01w07 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w07') ) : ?><?php endif; ?></div>
    <!-- r01w08 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w08') ) : ?><?php endif; ?></div>
    <!-- r01w09 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w09') ) : ?><?php endif; ?></div>
    <!-- r01w10 --><div class="rows"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('r01w10') ) : ?><?php endif; ?></div>
    </div>

    Functions.php (40 times)

    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => 'r01w01',
    	    'before_widget' => '',
            'after_widget' => '',
            'before_title' => '<div class="widgetheading"><h3>',
            'after_title' => '</h3></div>',
        ));

    style.css

    .widgetheading {
    	width: 198px;
    	margin: -6px;
    	margin-bottom: 10px;
    	padding: 5px;
    	height: 15px;
    	border-top-left-radius: 10px;
    	border-top-right-radius: 10px;
    	background-color: #22a7df;
    	color: #fff;
    	font-size: small;
    	text-decoration: none;
    	font-family: Arial, Helvetica, sans-serif;
    }
    .rows {
    	width: 196px;
    	float: left;
    	padding: 5px;
    	margin-bottom: 20px;
    	background: #fcebc7;
    	border-radius: 10px;
    	border: 1px;
    	border-style: solid;
    	border-color: #22a7df;
    }
    .rows p {
    	font-style:italic;
    	color:#555;
    	font-size:80%;
    }
    .rows li {
    	margin-left: -17px;
    	padding: 5px 0;
    	list-style: none;
    }
    .row1, .row2, .row3, .row4 {
    	position: relative;
    	width: 200px;
    	float: left;
    	margin: 10px;
    	padding: 5px;
    }

Viewing 15 replies - 16 through 30 (of 33 total)