• Resolved momodulor

    (@momodulor)


    Hi!
    I have installed two sites, using multisite (subfolder). I did it to have two different blogs. In both blogs posts’ pages assigned from the Settings/Reading.

    I need to have different intros for each blog. I tried to assign another page template for the second blog – it does not work.
    If I add something above the Loop in index.php it appears in both blogs.

    What is the best decision for me? I would have an opportunity to change these intros using wordpress page editor.

    I found at one forum this code which is not working for me:

    <?php
    global $paged;
    if(is_home() && $paged == “1”) :
    ?>

    <?php
    $my_query = new WP_Query(‘pagename=[name of my page]’); // here is the name of the necessary page goes
    while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    <div class=”post”>
    <h1><?php the_title(); ?></h1>
    <?php the_content(‘ ‘); ?>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    You could use the switch_to_blog() function OR if you use a static page, you can put in a call to the loop above it and customize the page on the admin end. That is, have the page itself hold ONLY the part you want customized, and the page template have the rest, with a call to the loop to pull in the customization.

    Thread Starter momodulor

    (@momodulor)

    Thanks, Ipstenu,

    I am not a really php code person I am a graphic designer. I can read some code but I am not able to write it by myself. I use for both blogs static pages. I tried to change the template for second blog – but it does not work. It seems to me wordpress use only index.php for the posts pages, am I right?

    I would prefer to have an opportunity to change this static text in wordpress editor. Because this is not my site, this is a site for local community and if I move from this area people should have an opportunity to change it without me (from Dashboard).

    Could it be possible to ask you about some details you wrote:

    if you use a static page, you can put in a call to the loop above it and customize the page on the admin end. That is, have the page itself hold ONLY the part you want customized, and the page template have the rest, with a call to the loop to pull in the customization.

    But actually I did not understand what it means, sorry about this…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    The easiest way is to make a page template.
    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    In that template will be a call for the normal page loop. You just want to hard code in the stuff that’s there on all the pages.

    It is PHP coding, and yes you will be learning fun new stuff 🙂

    Thread Starter momodulor

    (@momodulor)

    Thanks for this link.

    I did read it thoroughly but I still do not understand how the

    “call for the normal page loop”

    looks like…

    Copy/paste it from your index.php

    looks like this:
    http://codex.wordpress.org/The_Loop

    Thread Starter momodulor

    (@momodulor)

    Thanks to all,

    I asked php coder – he wrote me couple lines of code to place the different text to the different blogs:

    <div class="postItem">
    
    				 <?php  $parent_title = get_the_title($post->post_parent); ?>  		
    
    						<div class="categs"><?php if(($parent_title!="PostName#1")&&($parent_title!="PostName#2") ) the_category(', ') ?></div>
    						<div class="meta">
    
    							<div><?php if(($parent_title!="PostName#1")&&($parent_title!="PostName#2") ) the_time('M j, Y');  ?></div>
    							<div class="icoAuthor"><?php if(($parent_title!="PostName#1")&&($parent_title!="PostName#2") ) the_author_link(); ?></div>
    							<div class="icoComments"><?php if(($parent_title!="PostName#1")&&($parent_title!="PostName#2") ) comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?></div>
    						</div>
    
    						<h1><a href="<?php if(($parent_title!="PostName#1")&&($parent_title!="PostName#2") ) the_permalink();  ?>"><?php if(($parent_title!="PostName#1")&&($parent_title!="PostName#2") ) the_title(); ?></a></h1>
    
    						<?php the_content(__('Continue reading &raquo;')); ?>
    					</div>

    Have a good one!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘how to add different static text on different blogs in my multisite wordpress’ is closed to new replies.