i’m currently using this and it looks for the billing state and works great
<?php
if ($this->order->billing_state == 'ny' && $item['sku'] == 'ny01'):
echo '<table class="page1">';
elseif ():
endif;
?><?php endforeach; endif; ?>
I now need to switch my if statement to look for
$wpo_wcpdf->custom_field[‘myfield7’] instead of $this->order->billing_state
my statement looks like this but it’s not resolving. can you see what’s wrong here?
if ($this->order->custom_field['myfield7'] == 'ny' && $item['sku'] == 'ny01'):
echo '<table class="page1">';
https://www.ads-software.com/plugins/woocommerce-pdf-invoices-packing-slips/
]]>if(function_exists('wp_commentnavi')) { wp_commentnavi(); }
which is the comment pagination
and
if(function_exists('wp_commentnavi_all_comments_link')) { wp_commentnavi_all_comments_link(); }
which is the all comments link.
I would like the second, all the comments link, to be only displayed if
a) there are more than x comments OR
b) if the comment pagination isn’t displayed neither should the all comments link.
Essentially I want to say display all comments link if there are more than x comments, if not don’t display all comments link.
Anyone know the code required to do this?
Thanks in advance!
https://www.ads-software.com/plugins/wp-commentnavi/
]]>I have this line of code on my sidebar.php file in WordPress:
<?php if($post_name == ‘coaching’): ?>
This declares a custom sidebar content once the page is visited. The problem here is that I’d like to add additional pages for this custom sidebar to appear. What should be the correct code that I’ll use?
Thanks for the help.
]]>Is there a way to choose a current state based on post category?
e.g.
<li <?php if is category1 || category2 || etc ?> class=”current <?php } ?>>News
Thanks for your help in advance.
]]>Can anyone advise on what conditional statement I need to use here?
<?php if ( ?????? ) : ?>
Thanks
]]>I need help with the code below.
<?php if(has_tag(array('Actress','Model','Singer')) ) { ?>
<li class="occupation">Occupation:
<?php if(has_tag('Actress')){ ?><a href="https://www.galleryfake.com/tag/Actress">Actress</a><?php } ?>
<?php if(has_tag('Model')){ ?><a href="https://www.galleryfake.com/tag/Model">Model</a><?php } ?>
<?php if(has_tag('Singer')){ ?><a href="https://www.galleryfake.com/tag/Singer">Model</a><?php } ?>
</li>
<?php } ?>
The code currently displays this in a post “Occupation: Actress” or “Occupation: Singer”… and then adds a link to the specific tag page.
The problem I have with this is that if a post has more than 1 of these tags then the spacing is wrong. It displays as “Occupation: ActressSinger” or “Occupation: ActressModel”.
I want it to display commas in-between the different occupations, so it would show like this “Occupation: Actress, Singer”.
How could I achieve that?
Also, is there an easier way to do it than I’m doing it?
Thanks!
P.S. – I’ve just started coding so still suck
]]>I have an item in my footer that I would like to only show on the home page. Traditionally, I would use such a code to accomplish this:
<?php if (is_home()) { ?>
**the item I want to show***
<?php } ?>
In troubleshooting this, I have determined that no conditional statements will work on my website if placed in the footer section. Additionally, I have discovered that while conditional statements will work if placed in my sidebar, they won’t work if I use “is_home” or “is_front_page”. I don’t get an error, just nothing shows up.
Using statements such as “is_category” work just fine if in my sidebar, but not in my footer.
That is probably two different issues, but in either case I’m stumped by the occurance.
What could be preventing such code from working?
Thanks in advance for any help.
~Christian
I have wrote this piece of code so if the current page is category id 3 (my news category) then my news sub menu will appear.
It may be wrong but it works.
if ($cat = array(3) ) {
$cat = array(3);
What i want to do is apply the same rule for more categories. I need my portfolio, about and faq categories individuals menu’s to appear (id’s = 11,12,14) but i dont know how to add more to my code.
Can anyone help?
]]><?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php
if( $post->post_excerpt ) {
the_excerpt(); comments_number('(0)', '(1)', '(%)');
} else {
}
?>
</li>
<?php endwhile; ?>
This produces the following for articles that have excerpts:
Article title
Article excerpt (# comments)
And this if they don’t:
Article title
I would like to edit the code so it produces the following for articles that have excerpts:
Article title – Article excerpt (# comments)
And this if they don’t:
Article title
Presumably in order to do this I have to incorporate the text string ” – ” at some point in the if( $post->post_excerpt ) part of the code. But I don’t know how and all my efforts to do it have produced PHP errors.
I’m sure someone with a basic knowledge of PHP could solve this in a second. Any takers?
Thanks in advance…
]]>My site looks like
Number of Posts: 25
Percentage of Posts on the Site: 86.21%
Website: https://www.ihopeyourearsbleed.com
Last.FM: https://www.last.fm/user/skinnymckinney
Aim: n/a
But would like to make it so that if they don’t specify one, i can hide that whole line.
Any pointers?
]]>