I have been having problems with the else if function. It only takes three of the values provided with it.
This is the formula I am using (when D is the amount of customers) to determine the product price
IF( D <=10000 AND D >0 ) {599}
ELSE IF( D >10000 AND D <=25000) { 1199 }
ELSE IF ( D >25000 AND D <=10000) { 1799 }
ELSE IF ( D > 10000 AND D <=20000) { 2399 }
ELSE IF ( D > 20000 AND D <=50000)
{2999}
However, the only values that get displayed are 599, 1199 and 2999. (even if the amount of customers correlate to the other two prices)
What is going wrong?
Sincerely,
Saule Daniulaityte
]]><?php if( shortcode_exists( 'postexpirator' ) ) { ?>
<?php echo do_shortcode('[postexpirator]'); ?>
<?php } elseif( get_post_meta($post->ID, 'avslutas', true) ) { ?>
<?php echo get_post_meta($post->ID, "avslutas", true); ?>
<?php } else { ?>
<p>Tills vidare</p>
<?php } ?>
]]><?php
if($item->product_id == ‘2’){
if($item->quantity == ‘2’) echo ‘<img src=”ticket7.jpg”>’;
echo <div id=”Layer1″ <?php echo $order->bill_first_name ?> </div>
elseif($item->quantity == ‘5’) echo ‘<img src=”ticket8.jpg” >’;
echo <div id=”Layer2″ <?php echo $order->bill_first_name ?> </div>
else echo ‘<img src=”ticket9.jpg” width=”208″ height=”293″>’;
echo <div id=”Layer3″ <?php echo $order->bill_first_name ?> </div>
}
?>
<?php if ( is_page( ( 3 ) {
<script type="text/javascript" charset="utf-8" src="<?php bloginfo('template_directory'); ?>script1.js"></script>
} elseif ( is_page( ( 18 ) {
<script type="text/javascript" charset="utf-8" src="<?php bloginfo('template_directory'); ?>/script18.js"></script>
} endif; ?>
Where is my problem occurring and what is the fix?
]]>I have the settings pointing to a static home page and have the blog at /blog.
Here’s the code and the url is https://www.dityseo.com:
<div id=”<?php
if(is_page(‘home’)){
echo “pagetitleseo”;}
elseif(is_home()){
echo “pagetitleseo”;}
elseif(is_page(‘website-optimization’)){
echo “pagetitlewebsiteoptimization”;}
elseif(is_page(‘start-a-blog’)){
echo “pagetitlestartablog”;}
elseif(is_page(‘search-engine-optimization’)){
echo “pagetitleseo”;}
elseif(is_page(‘pricing’)){
echo “pagetitlepricing”;}
elseif(is_page(‘contact-us’)){
echo “pagetitlecontact”;}
elseif(is_page(‘blog’)){
echo “pagetitleblog”;}
?>”></div>
What i need it to say is the following:
If user has logged in, echo ‘redirect’;
If user has logged in and is supporter, echo ‘welcome’
else, echo’welcome to my website’
I have tried the following:
if ($user_ID) {
echo "im logged in";
} elseif (is_supporter()) {
echo "im subscribed";
} else {
echo "redirect";
}
?>
]]><!-- START USER-FUNCTION -->
<?php
/*
* function display_category() - calls custom images dependent
* on the category assigned to the post.
*
* NOTE: only works when called from inside the WordPress loop!
*
* @global object $post
*/
function display_category() {
global $post;
?>
<!--Begin Function-->
<?php if (in_category('1') ):?>
<img src="<?php bloginfo('template_directory') ?>../i/image1.gif" alt='1' />
<?php elseif (in_category('2') ):?>
<img src="<?php bloginfo('template_directory') ?>../i/image2.gif" alt='2' />
<?php elseif (in_category('3') ):?>
<img src="<?php bloginfo('template_directory') ?>../i/image3.gif" alt='3' />
<?php elseif (in_category('4') ):?>
<img src="<?php bloginfo('template_directory') ?>../i/image4.gif" alt='4' />
<?php elseif (in_category('5') ):?>
<img src="<?php bloginfo('template_directory') ?>../i/image5.gif" alt='5' />
<?php endif; ?>
<!--END Function-->
<?php } ?>
<!-- END USER-FUNCTION -->
Inside of my wordpress loop, I want to simply do this:
<div id="cat_container"><?php display_category(); ?></div>
That way, this little code calls the function, and displays an appropriate image based upon the category (not the id) for which it is assigned. When this is seen:
<?php if (in_category('1') ):?>
I’m calling the category named 1.
I’ve looked at both the codex’s Loop in Action, and this reference in an attempt to get this to work. I’ve tried several variations of the above code, and nothing works. I have gotten the first IF statement to work however, if I include no other elseif code.
Any help would be greatly appreciated.
]]><?php if (is_page()) { ?>
<p>something for all other pages goes here</p>
<?php } elseif (is_page('37')) { ?>
<p>something for page 37 only goes here</p>
<?php } ?>
]]>