<?php echo do_shortcode( '[user_favorites include_thumbnails="true" thumbnail_size="thumbnail"]' ); ?>
But I need to display little bit more informations that are stored in post meta made with ACF PRO. So I don’t think that shortcode can let me do this. How can I query all posts saved as favourites by user including ACF fields on the WP user backend (custom menu page)?
Or maybe there is any way to ad if/else in post_query like IF game is in my FAV then show it! Using simple query like:
$args = array(
'post_type' => 'games',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'ASC',
);
]]>Thank you!
<?php if ( ! defined( ‘ABSPATH’ ) ) exit; // Exit if accessed directly ?>
<?php do_action( ‘wpo_wcpdf_before_document’, $this->get_type(), $this->order ); ?>
<table class=”head container”>
<tr>
<td class=”header”>
<?php
if( $this->has_header_logo() ) {
$this->header_logo();
} else {
echo $this->get_title();
}
?>
</td>
<td class=”shop-info”>
<div class=”shop-name”><h3><?php $this->shop_name(); ?></h3></div>
<div class=”shop-address”><?php $this->shop_address(); ?></div>
</td>
</tr>
</table>
<h1 class=”document-type-label”>
<?php if( $this->has_header_logo() ) echo $this->get_title(); ?>
</h1>
<?php do_action( ‘wpo_wcpdf_after_document_label’, $this->get_type(), $this->order ); ?>
<table class=”order-data-addresses”>
<tr>
<td class=”address billing-address”>
<!– <h3><?php _e( ‘Billing Address:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3> –>
<?php do_action( ‘wpo_wcpdf_before_billing_address’, $this->type, $this->order ); ?>
<?php $this->billing_address(); ?>
<?php do_action( ‘wpo_wcpdf_after_billing_address’, $this->type, $this->order ); ?>
<?php if ( isset($this->settings[‘display_email’]) ) { ?>
<div class=”billing-email”><?php $this->billing_email(); ?></div>
<?php } ?>
<?php if ( isset($this->settings[‘display_phone’]) ) { ?>
<div class=”billing-phone”><?php $this->billing_phone(); ?></div>
<?php } ?>
</td>
<td class=”address shipping-address”>
<?php if ( isset($this->settings[‘display_shipping_address’]) && $this->ships_to_different_address()) { ?>
<h3><?php _e( ‘Ship To:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3>
<?php do_action( ‘wpo_wcpdf_before_shipping_address’, $this->type, $this->order ); ?>
<?php $this->shipping_address(); ?>
<?php do_action( ‘wpo_wcpdf_after_shipping_address’, $this->type, $this->order ); ?>
<?php } ?>
</td>
<td class=”order-data”>
<table>
<?php do_action( ‘wpo_wcpdf_before_order_data’, $this->get_type(), $this->order ); ?>
<?php if ( isset($this->settings[‘display_number’])) { ?>
<tr class=”invoice-number”>
<th><?php _e( ‘Invoice Number:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>
<td><?php $this->invoice_number(); ?></td>
</tr>
<?php } ?>
<?php if ( isset($this->settings[‘display_date’])) { ?>
<tr class=”invoice-date”>
<th><?php _e( ‘Invoice Date:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>
<td><?php $this->invoice_date(); ?></td>
</tr>
<?php } ?>
<tr class=”order-number”>
<th><?php _e( ‘Order Number:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>
<td><?php $this->order_number(); ?></td>
</tr>
<tr class=”order-date”>
<th><?php _e( ‘Order Date:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>
<td><?php $this->order_date(); ?></td>
</tr>
<tr class=”payment-method”>
<th><?php _e( ‘Payment Method:’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></th>
<td><?php $this->payment_method(); ?></td>
</tr>
<?php do_action( ‘wpo_wcpdf_after_order_data’, $this->get_type(), $this->order ); ?>
</table>
</td>
</tr>
</table>
<?php do_action( ‘wpo_wcpdf_before_order_details’, $this->get_type(), $this->order ); ?>
<table class=”order-details”>
<thead>
<?php if ( $headers = wpo_wcpdf_templates_get_table_headers( $this ) ): ?>
<tr>
<?php
foreach ( $headers as $column_key => $header_data ) {
printf(‘<th class=”%s”><span>%s</span></th>’, $header_data[‘class’], $header_data[‘title’]);
}
?>
</tr>
<?php endif ?>
</thead>
<tbody>
<?php
$tbody = wpo_wcpdf_templates_get_table_body( $this );
if( sizeof( $tbody ) > 0 ) {
foreach( $tbody as $item_id => $item_columns ) {
$row_class = apply_filters( ‘wpo_wcpdf_item_row_class’, $item_id, $this->get_type(), $this->order, $item_id );
printf(‘<tr class=”%s”>’, $row_class);
foreach ($item_columns as $column_key => $column_data) {
printf(‘<td class=”%s”><span>%s</span></td>’, $column_data[‘class’], $column_data[‘data’]);
}
echo ‘</tr>’;
}
}
?>
</tbody>
</table>
<table class=”notes-totals”>
<tbody>
<tr class=”no-borders”>
<td class=”no-borders”>
<?php do_action( ‘wpo_wcpdf_before_customer_notes’, $this->get_type(), $this->order ); ?>
<div class=”customer-notes”>
<?php if ( $this->get_shipping_notes() ) : ?>
<h3><?php _e( ‘Customer Notes’, ‘woocommerce-pdf-invoices-packing-slips’ ); ?></h3>
<?php $this->shipping_notes(); ?>
<?php endif; ?>
</div>
<?php do_action( ‘wpo_wcpdf_after_customer_notes’, $this->get_type(), $this->order ); ?>
</td>
<td class=”no-borders totals-cell” style=”width:40%”>
<table class=”totals”>
<tfoot>
<?php
$totals = wpo_wcpdf_templates_get_totals( $this );
if( sizeof( $totals ) > 0 ) {
foreach( $totals as $total_key => $total_data ) {
?>
<tr class=”<?php echo $total_data[‘class’]; ?>”>
<th class=”description”><span><?php echo $total_data[‘label’]; ?></span></th>
<td class=”price”><span class=”totals-price”><?php echo $total_data[‘value’]; ?></span></td>
</tr>
<?php
}
}
?>
</tfoot>
</table>
</td>
</tr>
</tbody>
</table>
<?php do_action( ‘wpo_wcpdf_after_order_details’, $this->get_type(), $this->order ); ?>
<?php if ( $this->get_footer() ): ?>
<div id=”footer”>
<?php $this->footer(); ?>
</div><!– #letter-footer –>
<?php endif; ?>
<?php do_action( ‘wpo_wcpdf_after_document’, $this->get_type(), $this->order ); ?>
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/
]]>This is what I currently have in the header, however I notice some CSS happens on other pages when it shouldn’t.
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<?php if ( is_page_template( 'front-page.php' ) ) { ?>
<link rel="stylesheet" href="<?php bloginfo('front-page.css'); ?>">
<?php
} elseif ( is_page_template( 'home.php' ) ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/home.css" media="screen" type="text/css" />
<?php
} elseif ( is_page_template( 'digital.php' ) ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/digital.css" media="screen" type="text/css" />
<?php
} elseif ( is_page_template( 'print.php' ) ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/print.css" media="screen" type="text/css" />
<?php
} elseif ( is_page_template( 'video.php' ) ) { ?>
<link rel="stylesheet" href="<?php bloginfo('template_directory'); ?>/css/video.css" media="screen" type="text/css" />
<?php
} else {
}
?>
Any suggestions would be greatly appreciated.
]]>I have 2 kinds of layout for my posts one with a thumbnail and one without. I can load all my posts in my index.php but I’m stuck with the if/els condition to seperate my posts
post with thumbnail:
<article>
<div class="clearfix">
<h1>Post with thumbnail in background</h1>
<time>16 Januari</time>
</div>
<p>Post with thumbnail</p>
</article>
Post without thumbnail:
<article>
<h1>Normal post/h1>
<time>16 Januari</time>
<hr>
<p> a post without thumbnail</p>
</article>
I load all my content with this code:
<?php
if(have_posts()) {
while(have_posts()) {
the_post();?>
<article class="clearfix">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<time><?php the_date('l j F'); ?></time>
<hr>
<?php the_content(); ?>
</article>
<?php
}
}else{
echo '<p>No content found</p>';
}
?>
Anyone know how I might do this?
]]>[loop field=stick_post value=1]
Problem is I have another loop that displays posts from the same category and I want to exclude all posts where stick_post
has been checked.
Instead of excluding and skipping over these sticky posts entirely, it’s just printing out 2 columns worth of content instead of 3.
[raw]
[loop type=post category=features count=3 orderby=rand]
[if field=stick_post value=1][else]
<div class="col-md-4">
[field image image_class="img-square" size="thumbnail"]
</div>
[/if]
[/loop]
[/raw]
https://www.ads-software.com/plugins/custom-content-shortcode/
]]>I want to add if/else Statement in the Message Body, so depending on what the person selects (maybe using radio buttons), a specific image will be added to the message body and then sent to them.
I have a radio button with 3 options, and each option has an image with it (for example (1)flower, (2) cats, (3)beautiful landscape). Depending on what the person chooses, one of the image will be inserted into the email message body then being sent to them. So if the person selects the ‘flower’ image option, that image along with other text will be sent to the recipient.
Is it possible to add php code to my theme functions.php to get that to happen? or what other options are there to get this to work?
Thank you
https://www.ads-software.com/plugins/contact-form-7/
]]>A while ago my site had some issues with the host and the DB seems to have been hosed a bit. I lost about 400 posts, luckily I regularly back things up so I was able to restore them. The problem is, while the images in the actual post are there, the Featured Image is gone, and when looking through the Insert Media screen, none of them are there, even the ones displaying in the post. The post just happens to have the full URL to the image so it can find it.
Anyway, since there are so many posts, I wanted to setup an IF/Else statement that will display the Featured Image if it exists, or display a standard image if it doesn’t. Here is the code I’m using right now that doesn’t work.
<?php
if ( has_post_thumbnail() ) { ?>
<p class="image"><a title="<?php the_title(); ?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail( 'recent' ); ?></a></p>
<?php } else{ ?>
<img src="https://www.one-quest.com/wp-content/themes/One-Quest3/images/logo.png" width="64" height="64" alt="<?php the_title(); ?>" />
<?php } ?>
I starting to wonder if maybe somewhere in the database or something the effected posts still have a link for a featured image being true. I’m not a database person though so I’m not even sure if that’s possible or if there is anyway to clear it without also clearing all the working posts.
Anyone have any tips or thoughts I could try?
]]>Is there a way I can add an if/else statement inside a page template to only display code if the post has been highlighted as a ‘featured post’?
I’ve found the code below as an example:
<?php if ( get_post_meta( get_the_ID(), 'featured', true ) ) : ?>
<h3>SHOW IF FEATURED</h3>
<?php else : ?>
<h3>SHOW IF NOT FEATURED</h3>
<?php endif;?>
… but it doesn’t work when I use it inside a particular post type.
Has anyone else managed to get WordPress to offer this functionality (the reason for the request is the website is a directory and my client wants to be able to show certain fields if a post is featured but hide them on other posts)
Or, if the code is correct, is there a way to get it to work on particular post types?
Thanks so much for your help
Phil
Parse error: syntax error, unexpected ‘<‘ in /home/nerej/public_html/wp-content/themes/nerej/header.php on line 70.
Line 70 starts with the first “<div class”
Here is the code:
<?php
if ( in_category( 'connecticut' )) {
if(get_field('con_block_top', 'option')) {
<div class="bottom-header">
<div class="container">
<a target = '_blank' href="<?php the_field('con_block_top_link', 'option'); ?> "><img src="<?php the_field('con_block_top', 'option'); ?>" /></a>
</div>
</div>
} ?>
} elseif ( in_category( 'shopping-centers' )) {
if(get_field('con_block_top', 'option')) {
<div class="bottom-header">
<div class="container">
<a target = '_blank' href="<?php the_field('con_block_top_link', 'option'); ?> "><img src="<?php the_field('con_block_top', 'option'); ?>" /></a>
</div>
</div>
} ?>
} else {
if(get_field('nerej_block_top', 'option')) {
<div class="bottom-header">
<div class="container">
<a target = '_blank' href="<?php the_field('nerej_block_top_link', 'option'); ?> "><img src="<?php the_field('nerej_block_top', 'option'); ?>" /></a>
</div>
</div>
} ?>
}
?>
]]>