Нужна помощь по BaddyPress

Оринаих
На сайте с 13.04.2008
Offline
147
990

Застопорилась на мелочах. Подскажите, плиз, кто в курсе, как в баддипресс можно вывести статичную запись на главной — так, чтобы обойтись без рубрики и плагинов?

В идеале — добавить текст в index.php (как в вордпрессе), но не разберусь, какой там должен быть код.

Заранее спасибо

© TextBroker.ru - копирайтинг на заказ (http://textbroker.ru/?source=search) © TextReporter.ru - наполнение сайтов и соцгрупп (http://textreporter.ru/?source=search) © TextDreamer.ru - слоганы, нейминг (http://textdreamer.ru/?source=search)
Оринаих
На сайте с 13.04.2008
Offline
147
#1

Апну топик. Поскольку пока так и не нашла решения, как же это сделать.

Может, всё-таки кто-то знает? :)

Sentoro
На сайте с 18.03.2007
Offline
149
#2
Оринаих:
вывести статичную запись

Можно сделать так:


<?php if ($_SERVER["REQUEST_URI"] == "/") { ?>

тут текст для главной

<?php } ?>

это в index.php

Продается СДЛ на тему инвестирования (http://www.telderi.ru/ru/viewsite/903457)
vooo
На сайте с 25.08.2011
Offline
83
#3
Sentoro:
Если выводить нужно к примеру текст, можно сделать так:


<?php if ($_SERVER["REQUEST_URI"] == "/") { ?>

тут текст для главной

<?php } ?>


это в index.php

я не знаком с данной cms, но скорее всего формируется переменная контента (в зависимости от стараницы), Вам надо ее выловить и подменить значение, по условию, предложенному Sentoro, т.к. если ее не подменять, то выведется и сгенерированный контент и Ваш

Sentoro
На сайте с 18.03.2007
Offline
149
#4

Оринаих, покажите содержамое файла index.php, скажем точнее, как и что вставить.

---------- Добавлено в 12:21 ---------- Предыдущее сообщение было в 12:21 ----------

vooo, зачем что то подменять, есть условие if главная и else все остальное

Оринаих
На сайте с 13.04.2008
Offline
147
#5

Sentoro, вот такой код (index.php):

<?php get_header() ?>


<div id="content">
<div class="padder">

<?php do_action( 'bp_before_blog_home' ) ?>

<?php do_action( 'template_notices' ) ?>

<div class="page" id="blog-latest" role="main">

<?php if ( have_posts() ) : ?>

<?php bp_dtheme_content_nav( 'nav-above' ); ?>

<?php while (have_posts()) : the_post(); ?>

<?php do_action( 'bp_before_blog_post' ) ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="author-box">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
<p><?php printf( _x( 'by %s', 'Post written by...', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>

<?php if ( is_sticky() ) : ?>
<span class="activity sticky-post"><?php _ex( 'Featured', 'Sticky post', 'buddypress' ); ?></span>
<?php endif; ?>
</div>

<div class="post-content">
<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<p class="date"><?php printf( __( '%1$s <span>in %2$s</span>', 'buddypress' ), get_the_date(), get_the_category_list( ', ' ) ); ?></p>

<div class="entry">
<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><p>' . __( 'Pages: ', 'buddypress' ), 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
</div>

<p class="postmetadata"><?php the_tags( '<span class="tags">' . __( 'Tags: ', 'buddypress' ), ', ', '</span>' ); ?> <span class="comments"><?php comments_popup_link( __( 'No Comments ***187;', 'buddypress' ), __( '1 Comment ***187;', 'buddypress' ), __( '% Comments ***187;', 'buddypress' ) ); ?></span></p>
</div>

</div>

<?php do_action( 'bp_after_blog_post' ) ?>

<?php endwhile; ?>

<?php bp_dtheme_content_nav( 'nav-below' ); ?>

<?php else : ?>

<h2 class="center"><?php _e( 'Not Found', 'buddypress' ) ?></h2>
<p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'buddypress' ) ?></p>

<?php get_search_form() ?>

<?php endif; ?>
</div>

<?php do_action( 'bp_after_blog_home' ) ?>

</div><!-- .padder -->
</div><!-- #content -->

<?php get_sidebar() ?>

<?php get_footer() ?>
Sentoro
На сайте с 18.03.2007
Offline
149
#6

Вот так попробуйте



<?php get_header() ?>

<div id="content">
<div class="padder">

<?php do_action( 'bp_before_blog_home' ) ?>

<?php do_action( 'template_notices' ) ?>

<div class="page" id="blog-latest" role="main">

<?php if ($_SERVER["REQUEST_URI"] == "/") { ?>

<p>Вот текст на главной</p>

<?php } else { ?>

<?php if ( have_posts() ) : ?>

<?php bp_dtheme_content_nav( 'nav-above' ); ?>

<?php while (have_posts()) : the_post(); ?>

<?php do_action( 'bp_before_blog_post' ) ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="author-box">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
<p><?php printf( _x( 'by %s', 'Post written by...', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>

<?php if ( is_sticky() ) : ?>
<span class="activity sticky-post"><?php _ex( 'Featured', 'Sticky post', 'buddypress' ); ?></span>
<?php endif; ?>
</div>

<div class="post-content">
<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<p class="date"><?php printf( __( '%1$s <span>in %2$s</span>', 'buddypress' ), get_the_date(), get_the_category_list( ', ' ) ); ?></p>

<div class="entry">
<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><p>' . __( 'Pages: ', 'buddypress' ), 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
</div>

<p class="postmetadata"><?php the_tags( '<span class="tags">' . __( 'Tags: ', 'buddypress' ), ', ', '</span>' ); ?> <span class="comments"><?php comments_popup_link( __( 'No Comments ***187;', 'buddypress' ), __( '1 Comment ***187;', 'buddypress' ), __( '% Comments ***187;', 'buddypress' ) ); ?></span></p>
</div>

</div>

<?php do_action( 'bp_after_blog_post' ) ?>

<?php endwhile; ?>

<?php bp_dtheme_content_nav( 'nav-below' ); ?>

<?php else : ?>

<h2 class="center"><?php _e( 'Not Found', 'buddypress' ) ?></h2>
<p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'buddypress' ) ?></p>

<?php get_search_form() ?>

<?php endif; ?>

<?php } ?>
</div>

<?php do_action( 'bp_after_blog_home' ) ?>

</div><!-- .padder -->
</div><!-- #content -->

<?php get_sidebar() ?>

<?php get_footer() ?>

Это на главной будет только статический текст, если нужно оставить что было на главной + стат. текст, то тогда так:


<?php get_header() ?>

<div id="content">
<div class="padder">

<?php do_action( 'bp_before_blog_home' ) ?>

<?php do_action( 'template_notices' ) ?>

<div class="page" id="blog-latest" role="main">

<?php if ($_SERVER["REQUEST_URI"] == "/") { ?>

<p>Вот текст на главной</p>

<?php } ?>

<?php if ( have_posts() ) : ?>

<?php bp_dtheme_content_nav( 'nav-above' ); ?>

<?php while (have_posts()) : the_post(); ?>

<?php do_action( 'bp_before_blog_post' ) ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="author-box">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
<p><?php printf( _x( 'by %s', 'Post written by...', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?></p>

<?php if ( is_sticky() ) : ?>
<span class="activity sticky-post"><?php _ex( 'Featured', 'Sticky post', 'buddypress' ); ?></span>
<?php endif; ?>
</div>

<div class="post-content">
<h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'buddypress' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

<p class="date"><?php printf( __( '%1$s <span>in %2$s</span>', 'buddypress' ), get_the_date(), get_the_category_list( ', ' ) ); ?></p>

<div class="entry">
<?php the_content( __( 'Read the rest of this entry &rarr;', 'buddypress' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link"><p>' . __( 'Pages: ', 'buddypress' ), 'after' => '</p></div>', 'next_or_number' => 'number' ) ); ?>
</div>

<p class="postmetadata"><?php the_tags( '<span class="tags">' . __( 'Tags: ', 'buddypress' ), ', ', '</span>' ); ?> <span class="comments"><?php comments_popup_link( __( 'No Comments ***187;', 'buddypress' ), __( '1 Comment ***187;', 'buddypress' ), __( '% Comments ***187;', 'buddypress' ) ); ?></span></p>
</div>

</div>

<?php do_action( 'bp_after_blog_post' ) ?>

<?php endwhile; ?>

<?php bp_dtheme_content_nav( 'nav-below' ); ?>

<?php else : ?>

<h2 class="center"><?php _e( 'Not Found', 'buddypress' ) ?></h2>
<p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'buddypress' ) ?></p>

<?php get_search_form() ?>

<?php endif; ?>

</div>

<?php do_action( 'bp_after_blog_home' ) ?>

</div><!-- .padder -->
</div><!-- #content -->

<?php get_sidebar() ?>

<?php get_footer() ?>

А вообще, для главной можно создать файл home.php, и там делать все, что нужно, этот файл будет только для главной.

Оринаих
На сайте с 13.04.2008
Offline
147
#7

Спасибо большое, получилось! :)

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий