Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End conditional PHP in wordpress theme

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #28616
    kloy
    Member

    Ok, I’m trying to get a flash banner to play on the home page.
    On all the other pages I’m want a set of random images to appear in the header. So I’m trying to create somekind of conditional statement. Both work individually. But I can’t seem to get the conditional statement to work….So I am trying to say—If at home use this html, if else , use this other html code

    Code:
    Makeshift
    Member

    Alright, a few problems here.

    I see you’re using the colons ‘:’ and the brackets ‘{‘ ‘}’.
    You can’t use both on the same statement.

    When using the colons, here is how it would go…

    Code:
    if($foo == $bar):
    do_someting();
    elseif:
    do_something_else();
    endif;

    When using the brackets…

    Code:
    id($foo == $bar){
    so_something();
    }else{
    so_something_else();
    }

    So, in this particular code, this isn’t your only problem…

    When using these statements as you are, it’s best not to echo the codes…

    Code:
    #73429
    kloy
    Member

    Thanks,
    Though the flash banner is not playing on the home page.
    Does <?php if(is_home()) looking for an index page.

    I’m doing all this in a wordpress theme and created a subfolder/staging before it goes live. So right now there is no index page.
    http://www.newseminary.org/staging/berke14q_wrdp/

    #73430
    kloy
    Member

    I figured it out. instead of using is_home() I’m using
    is_front_page()

    and now it works the way I want it to
    Thanks for your help!!

    #73444
    Makeshift
    Member

    Parse error: syntax error, unexpected T_ENDWHILE in /home/berke14q/public_html/staging/berke14q_wrdp/wp-content/themes/StudioBlue/StudioBlue/page.php on line 63

    Ya might wanna get that taken care of…

    No problem, that’s why we’re here!

    #73445
    kloy
    Member

    Oh, that error is referring to was referring to this….
    I’m also trying to get the home page to display sub page and am having some problems with now…
    I got this $pages code off the wordpress site…I’m not sure where to put it. I tried putting it the div with the content but it’s not working.

    If you go to the page now you won’t get that same error. The page will load but the sub pages don’t show up??

    Code:



    ” rel=”bookmark” title=”Permanent Link to “>

    ID.’&sort_column=post_date&sort_order=desc’);
    $count = 0;
    foreach($pages as $page)
    {
    $content = $page->post_content;
    if(!$content)
    continue;
    if($count >= 2)
    break;
    $count++;
    $content = apply_filters(‘the_content’, $content);
    ?>

    ID) ?>”>post_title ?>




    No Results Found

    The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.







Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.