Restrict Content Pro Expand Invoice Details - php

I am looking for advice on how to expand invoice details using the Restrict Content Pro Wordpress plugin. I'm unsure on how to go about showing the breakdown of a subscription level on an invoice. I've hit a learning curve with figuring this out with their code. I've attached the invoice.php, how do I tackle this?
My connumdrum: I have a subscription that is 295$. The breakdown is: Membership fee - 195$, Insurance Policy - 100$. I just need to show the breakdown, it's probably super simple.
I did try just putting a ul tag and just list the breakdown with li tags. But, that would cause confusion because it would show up all invoices with different levels.
Invoice Code:
<body>
<div id="main">
<header id="header">
<!-- Logo -->
<div class="logo">
<?php if ( ! empty( $rcp_options['invoice_logo'] ) ) : ?>
<img src="<?php echo esc_attr( $rcp_options['invoice_logo'] ); ?>" />
<?php endif; ?>
</div>
<!-- Invoice Details -->
<div class="alignright">
<h1><?php printf( __( 'Invoice %s', 'rcp' ), $rcp_payment->id ); ?> </h1>
</div>
<?php if( ! empty( $rcp_options['invoice_header'] ) ) : ?>
<p><?php echo $rcp_options['invoice_header']; ?></p>
<?php endif; ?>
</header>
<section id="contacts">
<div class="alignleft">
<header><?php printf( __( 'Invoice %s', 'rcp' ), $rcp_payment->id ); ?></header>
<article>
<?php if ( ! empty( $rcp_options['invoice_company'] ) ) : ?>
<p><strong><?php echo $rcp_options['invoice_company']; ?></strong></p>
<?php endif; ?>
<?php if ( ! empty( $rcp_options['invoice_name'] ) ) : ?>
<p><strong><?php echo $rcp_options['invoice_name']; ?></strong></p>
<?php endif; ?>
<?php if ( ! empty( $rcp_options['invoice_address'] ) ) : ?>
<p><strong><?php echo $rcp_options['invoice_address']; ?></strong></p>
<?php endif; ?>
<?php if ( ! empty( $rcp_options['invoice_address_2'] ) ) : ?>
<p><strong><?php echo $rcp_options['invoice_address_2']; ?></strong></p>
<?php endif; ?>
<?php if ( ! empty( $rcp_options['invoice_city_state_zip'] ) ) : ?>
<p><strong><?php echo $rcp_options['invoice_city_state_zip']; ?></strong></p>
<?php endif; ?>
<?php if ( ! empty( $rcp_options['invoice_email'] ) ) : ?>
<p><strong><?php echo $rcp_options['invoice_email']; ?></strong></p>
<?php endif; ?>
</article>
</div>
<div class="alignright">
<header><?php _e( 'Bill To:', 'rcp' ); ?></header>
<article>
<p><strong><?php echo $rcp_member->first_name . ' ' . $rcp_member->last_name; ?></strong></p>
<p><strong><?php echo $rcp_member->user_email; ?></strong></p>
<?php
/**
* Insert content after the member's name and email.
*
* #param object $rcp_payment Payment object from the database.
* #param RCP_Member $rcp_member Member object.
*/
do_action( 'rcp_invoice_bill_to', $rcp_payment, $rcp_member );
?>
</article>
</div>
</section>
<!-- Items -->
<section id="items">
<header><?php _e( 'Invoice Items:', 'rcp' ); ?></header>
<table>
<tbody>
<tr>
<td class="name"><?php echo $rcp_payment->subscription; ?></td>
<td class="price"><?php echo rcp_currency_filter( $rcp_payment->amount ); ?></td>
</tr>
<?php do_action( 'rcp_invoice_items', $rcp_payment ); ?>
</tbody>
<tfoot>
<?php do_action( 'rcp_invoice_items_before_total_price', $rcp_payment ); ?>
<!-- Total -->
<tr>
<td class="name"><?php _e( 'Total Price:', 'rcp' ); ?></td>
<td class="price"><?php echo rcp_currency_filter( $rcp_payment->amount ); ?></td>
</tr>
<!-- Paid -->
<tr>
<td class="name"><?php _e( 'Payment Status:', 'rcp' ); ?></td>
<td class="price"><?php echo rcp_get_payment_status_label( $rcp_payment ); ?></td>
</tr>
</tfoot>
</table>
</section>
<!-- Additional Info -->
<section id="additional-info">
<div class="alignleft">
<header><?php _e( 'Additional Info:', 'rcp' ); ?></header>
<article>
<p><?php echo __( 'Payment Date:', 'rcp' ) . ' ' . date_i18n( get_option( 'date_format' ), strtotime( $rcp_payment->date, current_time( 'timestamp' ) ) ); ?></p>
</article>
<?php if( ! empty( $rcp_options['invoice_notes'] ) ) : ?>
<article>
<?php echo wpautop( wp_kses_post( $rcp_options['invoice_notes'] ) ); ?>
</article>
<?php endif; ?>
<?php do_action( 'rcp_invoice_additional_info', $rcp_payment ); ?>
</div>
</section>
<?php do_action( 'rcp_invoice_after_additional_info', $rcp_payment ); ?>
<footer id="footer">
<?php if( ! empty( $rcp_options['invoice_footer'] ) ) : ?>
<p><?php echo $rcp_options['invoice_footer']; ?></p>
<?php endif; ?>
<p class="print alignright"><?php _e( 'Print', 'rcp' ); ?></p>
</footer>
</div>

Related

Buddyboss Group Filter

In the Buddyboss Group Loop are all groups displayed.
I want to add a filter that only groups with a specific categrorie are displayed in the first grid.
I added the comment to the first grid and found out that i can display another grid when
i duplicate the code a second time, but i have the filter problem.
Then i want to add another grid with also a filter to another group categorie.
How can i achieve this?
I dont get it how to add a filter.
<?php
/**
* BuddyBoss - Groups Loop
*
* #since BuddyPress 3.0.0
* #version 3.1.0
*/
bp_nouveau_before_loop(); ?>
<?php if ( bp_get_current_group_directory_type() ) : ?>
<div class="bp-feedback info">
<span class="bp-icon" aria-hidden="true"></span>
<p class="current-group-type"><?php bp_current_group_directory_type_message(); ?></p>
</div>
<?php endif; ?>
<?php $cover_class = bp_disable_group_cover_image_uploads() ? 'bb-cover-disabled' : 'bb-cover-enabled'; ?>
<?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?>
<?php bp_nouveau_pagination( 'top' ); ?>
//FIRST GRID ONLY FOR "KOMMISIONEN"
<ul id="groups-list-kommissionen" class="<?php bp_nouveau_loop_classes(); ?> <?php echo $cover_class; ?>">
<?php
while ( bp_groups() ) :
bp_the_group();
?>
<li <?php bp_group_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_group_id(); ?>" data-bp-item-component="groups">
<div class="list-wrap">
<?php if( !bp_disable_group_cover_image_uploads() ) { ?>
<?php
$group_cover_image_url = bp_attachments_get_attachment( 'url', array(
'object_dir' => 'groups',
'item_id' => bp_get_group_id(),
) );
$default_group_cover = buddyboss_theme_get_option( 'buddyboss_group_cover_default', 'url' );
$group_cover_image_url = $group_cover_image_url ?: $default_group_cover;
?>
<div class="bs-group-cover only-grid-view"><img src="<?php echo $group_cover_image_url; ?>"></div>
<?php } ?>
<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
<div class="item-avatar">
<?php bp_group_avatar( bp_nouveau_avatar_args() ); ?>
<div class="groups-loop-buttons only-grid-view">
<?php bp_nouveau_groups_loop_buttons(); ?>
</div>
</div>
<?php endif; ?>
<div class="item">
<div class="item-block">
<h2 class="list-title groups-title"><?php bp_group_link(); ?></h2>
<?php if ( bp_nouveau_group_has_meta() ) : ?>
<p class="item-meta group-details only-list-view"><?php bp_nouveau_group_meta(); ?></p>
<p class="item-meta group-details only-grid-view"><?php
$meta = bp_nouveau_get_group_meta();
echo $meta['status']; ?>
</p>
<?php endif; ?>
<p class="last-activity item-meta">
<?php
printf(
/* translators: %s = last activity timestamp (e.g. "active 1 hour ago") */
__( 'active %s', 'buddyboss-theme' ),
bp_get_group_last_active()
);
?>
</p>
</div>
<div class="item-desc group-item-desc only-list-view"><?php bp_group_description_excerpt( false , 150 ) ?></div>
<?php bp_nouveau_groups_loop_item(); ?>
<div class="groups-loop-buttons footer-button-wrap"><?php bp_nouveau_groups_loop_buttons(); ?></div>
<div class="group-members-wrap only-grid-view">
<?php echo buddyboss_theme()->buddypress_helper()->group_members( bp_get_group_id(), array( 'member', 'mod', 'admin' ) ); ?>
</div>
</div>
</div>
</li>
<?php endwhile; ?>
<?php bp_nouveau_pagination( 'bottom' ); ?>
<?php else : ?>
<?php bp_nouveau_user_feedback( 'groups-loop-none' ); ?>
<?php endif; ?>
<?php
bp_nouveau_after_loop();
Okay i found the answer by trying all possible ways.
Here is the solution code.
<?php
/**
* BuddyBoss - Groups Loop
*
* #since BuddyPress 3.0.0
* #version 3.1.0
*/
bp_nouveau_before_loop(); ?>
<?php if ( bp_get_current_group_directory_type() ) : ?>
<div class="bp-feedback info">
<span class="bp-icon" aria-hidden="true"></span>
<p class="current-group-type"><?php bp_current_group_directory_type_message(); ?></p>
</div>
<?php endif; ?>
<?php $cover_class = bp_disable_group_cover_image_uploads() ? 'bb-cover-disabled' : 'bb-cover-enabled'; ?>
<?php if ( bp_has_groups( 'group_type=kommission' ) ) : ?>
<?php bp_nouveau_pagination( 'top' ); ?>
<ul id="groups-list-kommissionen" class="<?php bp_nouveau_loop_classes(); ?> <?php echo $cover_class; ?>">
<?php
while ( bp_groups() ) :
bp_the_group();
?>
<li <?php bp_group_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_group_id(); ?>" data-bp-item-component="groups">
<div class="list-wrap">
<?php if( !bp_disable_group_cover_image_uploads() ) { ?>
<?php
$group_cover_image_url = bp_attachments_get_attachment( 'url', array(
'object_dir' => 'groups',
'item_id' => bp_get_group_id(),
) );
$default_group_cover = buddyboss_theme_get_option( 'buddyboss_group_cover_default', 'url' );
$group_cover_image_url = $group_cover_image_url ?: $default_group_cover;
?>
<div class="bs-group-cover only-grid-view"><img src="<?php echo $group_cover_image_url; ?>"></div>
<?php } ?>
<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
<div class="item-avatar">
<?php bp_group_avatar( bp_nouveau_avatar_args() ); ?>
<div class="groups-loop-buttons only-grid-view">
<?php bp_nouveau_groups_loop_buttons(); ?>
</div>
</div>
<?php endif; ?>
<div class="item">
<div class="item-block">
<h2 class="list-title groups-title"><?php bp_group_link(); ?></h2>
<?php if ( bp_nouveau_group_has_meta() ) : ?>
<p class="item-meta group-details only-list-view"><?php bp_nouveau_group_meta(); ?></p>
<p class="item-meta group-details only-grid-view"><?php
$meta = bp_nouveau_get_group_meta();
echo $meta['status']; ?>
</p>
<?php endif; ?>
<p class="last-activity item-meta">
<?php
printf(
/* translators: %s = last activity timestamp (e.g. "active 1 hour ago") */
__( 'active %s', 'buddyboss-theme' ),
bp_get_group_last_active()
);
?>
</p>
</div>
<div class="item-desc group-item-desc only-list-view"><?php bp_group_description_excerpt( false , 150 ) ?></div>
<?php bp_nouveau_groups_loop_item(); ?>
<div class="groups-loop-buttons footer-button-wrap"><?php bp_nouveau_groups_loop_buttons(); ?></div>
<div class="group-members-wrap only-grid-view">
<?php echo buddyboss_theme()->buddypress_helper()->group_members( bp_get_group_id(), array( 'member', 'mod', 'admin' ) ); ?>
</div>
</div>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php bp_nouveau_pagination( 'bottom' ); ?>
<?php else : ?>
<?php bp_nouveau_user_feedback( 'groups-loop-none' ); ?>
<?php endif; ?>
<?php if ( bp_has_groups( 'group_type=task-force' ) ) : ?>
<?php bp_nouveau_pagination( 'top' ); ?>
<ul id="groups-list-taskForces" class="<?php bp_nouveau_loop_classes(); ?> <?php echo $cover_class; ?>">
<?php
while ( bp_groups() ) :
bp_the_group();
?>
<li <?php bp_group_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_group_id(); ?>" data-bp-item-component="groups">
<div class="list-wrap">
<?php if( !bp_disable_group_cover_image_uploads() ) { ?>
<?php
$group_cover_image_url = bp_attachments_get_attachment( 'url', array(
'object_dir' => 'groups',
'item_id' => bp_get_group_id(),
) );
$default_group_cover = buddyboss_theme_get_option( 'buddyboss_group_cover_default', 'url' );
$group_cover_image_url = $group_cover_image_url ?: $default_group_cover;
?>
<div class="bs-group-cover only-grid-view"><img src="<?php echo $group_cover_image_url; ?>"></div>
<?php } ?>
<?php if ( ! bp_disable_group_avatar_uploads() ) : ?>
<div class="item-avatar">
<?php bp_group_avatar( bp_nouveau_avatar_args() ); ?>
<div class="groups-loop-buttons only-grid-view">
<?php bp_nouveau_groups_loop_buttons(); ?>
</div>
</div>
<?php endif; ?>
<div class="item">
<div class="item-block">
<h2 class="list-title groups-title"><?php bp_group_link(); ?></h2>
<?php if ( bp_nouveau_group_has_meta() ) : ?>
<p class="item-meta group-details only-list-view"><?php bp_nouveau_group_meta(); ?></p>
<p class="item-meta group-details only-grid-view"><?php
$meta = bp_nouveau_get_group_meta();
echo $meta['status']; ?>
</p>
<?php endif; ?>
<p class="last-activity item-meta">
<?php
printf(
/* translators: %s = last activity timestamp (e.g. "active 1 hour ago") */
__( 'active %s', 'buddyboss-theme' ),
bp_get_group_last_active()
);
?>
</p>
</div>
<div class="item-desc group-item-desc only-list-view"><?php bp_group_description_excerpt( false , 150 ) ?></div>
<?php bp_nouveau_groups_loop_item(); ?>
<div class="groups-loop-buttons footer-button-wrap"><?php bp_nouveau_groups_loop_buttons(); ?></div>
<div class="group-members-wrap only-grid-view">
<?php echo buddyboss_theme()->buddypress_helper()->group_members( bp_get_group_id(), array( 'member', 'mod', 'admin' ) ); ?>
</div>
</div>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php bp_nouveau_pagination( 'bottom' ); ?>
<?php else : ?>
<?php bp_nouveau_user_feedback( 'groups-loop-none' ); ?>
<?php endif; ?>
<?php
bp_nouveau_after_loop();

YITH WooCommerce Wishlist: Help me show the first item / product thumbnail within the sidebar widget and wishlist manage areas?

I am using YITH Wishlist within WooCommerce, WordPress.
Within an individual wishlist - it displays the image, with 'remove from list', the product title and a link through to the individual product all working.
So going one step higher up the 'folders' when I display the individual wishlists within the Manage Wishlists page, I am only able to show the name of the list and the link through to that individual list where you can see all the products grouped. This is where I wish to be able to display the 'first product within that individual wishlist' 's first image or thumbnail.
I have tried and broken the script numerous times. How can I write a script that will grab that image and let me display it within the Manage Wishlist's page? Better yet, is there a shortcode that does this for me (if there is such a thing)?
Here is the pretty much stock relevant template files...
This is the manage page template (if you Ctrl+F for 'I WANT TO SHOW IMAGE HERE' to see where I want to pull image through) - where I want to display image:
<?php
/**
* Wishlist manage template
*
* #author Your Inspiration Themes
* #package YITH WooCommerce Wishlist
* #version 2.0.5
*/
if ( ! defined( 'YITH_WCWL' ) ) {
exit;
} // Exit if accessed directly
?>
<form id="yith-wcwl-form" action="<?php echo esc_url( YITH_WCWL()->get_wishlist_url( 'manage' ) ) ?>" method="post">
<!-- TITLE -->
<?php
do_action( 'yith_wcwl_before_wishlist_title' );
if( ! empty( $page_title ) ) {
echo apply_filters( 'yith_wcwl_wishlist_title', '<h2 class="h1 blue lh2 mt2 mb0 p0">Manage My Boards</h2>' );
}
do_action( 'yith_wcwl_before_wishlist_manage' );
?>
<table class="shop_table cart wishlist_table wishlist_manage_table" cellspacing="0" >
<thead>
<tr>
<th class="wishlist-name">
<span class="nobr">
Boards
<?php // echo apply_filters( 'yith_wcwl_wishlist_manage_name_heading', __( 'Wishlists', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php /* ?>
<th class="wishlist-privacy">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_privacy_heading', __( 'Privacy', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php */ ?>
<th class="wishlist-delete">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_delete_heading', __( 'Delete', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="wishlist-name">
<a title="<?php echo $default_wishlist_title ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'user' . '/' . $current_user_id ) ?>">
<?php echo $default_wishlist_title ?>
</a>
</td>
<?php /* ?>
<td class="wishlist-privacy">
<?php echo apply_filters( 'yith_wcwl_wishlist_manage_default_privacy', __( 'Public', 'yith-woocommerce-wishlist' ) )?>
</td>
<?php */ ?>
<td class="wishlist-delete"></td>
</tr>
<?php
$wishlist_count = 0;
if( ! empty( $user_wishlists ) ):
?>
<?php foreach( $user_wishlists as $wishlist ): ?>
<?php if( ! $wishlist['is_default'] ): ?>
<tr>
<td class="wishlist-name">
<a title="<?php echo $wishlist['wishlist_name'] ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] ) ?>">
<!-- I WANT TO SHOW IMAGE HERE (OF THE FIRST PRODUCT IN THE WISHLIST CURRENTLY BEING LOOPED THROUGH) -->
<?php echo $wishlist['wishlist_name'] ?>
</a>
</td>
<?php /* ?>
<td class="wishlist-privacy">
<select name="wishlist_options[<?php echo $wishlist['ID'] ?>][wishlist_privacy]" class="wishlist-visibility selectBox">
<option value="0" class="public-visibility" <?php selected( $wishlist['wishlist_privacy'], 0 ) ?> ><?php echo apply_filters( 'yith_wcwl_public_wishlist_visibility', __( 'Public', 'yith-woocommerce-wishlist' ) )?></option>
<option value="1" class="shared-visibility" <?php selected( $wishlist['wishlist_privacy'], 1 ) ?> ><?php echo apply_filters( 'yith_wcwl_shared_wishlist_visibility', __( 'Shared', 'yith-woocommerce-wishlist' ) )?></option>
<option value="2" class="private-visibility" <?php selected( $wishlist['wishlist_privacy'], 2 ) ?> ><?php echo apply_filters( 'yith_wcwl_private_wishlist_visibility', __( 'Private', 'yith-woocommerce-wishlist' ) )?></option>
</select>
</td>
<?php */ ?>
<td class="wishlist-delete">
<!-- <input type="checkbox" value="yes" name="wishlist_options[<?php echo $wishlist['ID'] ?>][delete]"/> -->
<a class="button" href="<?php echo esc_url( add_query_arg( 'wishlist_id', $wishlist['ID'], wp_nonce_url( YITH_WCWL()->get_wishlist_url( 'manage' ), 'yith_wcwl_delete_action', 'yith_wcwl_delete' ) ) ) ?>"><?php _e( 'Delete', 'yith-woocommerce-wishlist' ) ?></a>
</td>
</tr>
<?php
$wishlist_count ++;
endif;
?>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<td colspan="3">
<a class="btn button create-new-wishlist" href="<?php echo YITH_WCWL()->get_wishlist_url( 'create' ) ?>">
<?php echo apply_filters( 'yith_wcwl_create_new_wishlist_icon', '<i class="icon-plus"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_create_new_wishlist_title', __( 'Create a new board', 'yith-woocommerce-wishlist' ) )?>
</a>
<?php if( ! empty( $user_wishlists ) && $wishlist_count ): ?>
<button class="submit-wishlist-changes">
<?php echo apply_filters( 'yith_wcwl_mange_wishlist_icon', '<i class="icon-ok"></i>' )?>
<?php _e( 'Save Settings', 'yith-woocommerce-wishlist' ) ?>
</button>
<?php endif; ?>
</td>
</tr>
</tfoot>
</table>
<?php wp_nonce_field( 'yith_wcwl_manage_action', 'yith_wcwl_manage' )?>
<?php do_action( 'yith_wcwl_after_wishlist_manage' ); ?>
</form>
This is the individual wishlist page, with the working Show Product Image script (Ctrl+F 'GRABBING THE IMAGE SUCCESSFULLY' to get to relevant code) - where I can see a working example of pulling the image from a product through:
<?php
/**
* Wishlist page template
*
* #author Your Inspiration Themes
* #package YITH WooCommerce Wishlist
* #version 2.0.12
*/
if ( ! defined( 'YITH_WCWL' ) ) {
exit;
} // Exit if accessed directly
?>
<script type="text/javascript">
var root = document.documentElement;
root.className += ' wishlist-view';
</script>
<?php do_action( 'yith_wcwl_before_wishlist_form', $wishlist_meta ); ?>
<?php
function cmp($a, $b) {
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
uasort($users_wishlists, 'cmp');
?>
<?php /* ?>
<pre><code>
<?php
print_r($wishlist_items);
// print_r($users_wishlists);
?>
</code></pre>
<?php */ ?>
<!--
<div class="my-materials-sidebar bg-dark-blue white lg:absolute top-0 left-0 bottom-0">
<div class="bg-darken-3 p2 lg:p3 height-100 overflow-auto">
<h3 class="h1 mt0">My Materials</h3>
<h3 class="h2 lg:h1 mb1">My Boards</h3>
<ul class="list-reset my3 p0 uppercase lg:h3">
<li>Add new board</li>
<li>Manage boards</li>
</ul>
<ul class="list-reset m0 p0 uppercase lg:h3 boards">
<?php foreach ($users_wishlists as $users_wishlist) : ?>
<?php
$token = $users_wishlist['wishlist_token'];
$name = $users_wishlist['wishlist_name'];
?>
<?php /* <pre><code><?php print_r($users_wishlist); ?></code></pre> */ ?>
<li>
<?php if( $name ) : ?>
<a href="/my-materials/view/<?php echo $token; ?>">
<?php echo $name; ?>
</a>
<?php else : ?>
<a href="/my-materials">
Main board
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<ul class="list-reset m0 p0 uppercase lg:h3">
<li>
My account
</li>
<li>
Log out
</li>
</ul>
</div>
</div>
-->
<form id="yith-wcwl-form" action="<?php echo $form_action ?>" method="post" class="woocommerce">
<?php wp_nonce_field( 'yith-wcwl-form', 'yith_wcwl_form_nonce' ) ?>
<!-- TITLE -->
<?php
do_action( 'yith_wcwl_before_wishlist_title', $wishlist_meta );
if( ! empty( $page_title ) ) :
?>
All Boards
<?php if( count( $wishlist_items ) > 0 ) : ?>
<a href="#" class="btn dark-grey hover:black right" data-edit-board>Edit Board</a>
<?php else : ?>
<?php endif; ?>
<div class="wishlist-title <?php echo ( $is_custom_list ) ? 'wishlist-title-with-form' : ''?>">
<?php echo apply_filters( 'yith_wcwl_wishlist_title', '<h2 class="h1 blue lh2 mt2 mb0 p0">' . $page_title . '</h2>' ); ?>
<?php /* if( $is_custom_list ): ?>
<a class="btn button show-title-form">
<?php echo apply_filters( 'yith_wcwl_edit_title_icon', '<i class="fa fa-pencil"></i>' )?>
<?php _e( 'Edit title', 'yith-woocommerce-wishlist' ) ?>
</a>
<?php endif; */ ?>
</div>
<?php if( $is_custom_list ): ?>
<div class="hidden-title-form">
<input type="text" value="<?php echo $page_title ?>" name="wishlist_name"/>
<button class="button">
<?php echo apply_filters( 'yith_wcwl_save_wishlist_title_icon', '<i class="fa fa-check fa-fw"></i>' )?>
<span>
<?php _e( 'Save', 'yith-woocommerce-wishlist' )?>
</span>
</button>
<a class="hide-title-form btn button">
<?php echo apply_filters( 'yith_wcwl_cancel_wishlist_title_icon', '<i class="fa fa-remove fa-fw"></i>' )?>
<span>
<?php _e( 'Cancel', 'yith-woocommerce-wishlist' )?>
</span>
</a>
</div>
<?php endif; ?>
<?php
endif;
do_action( 'yith_wcwl_before_wishlist', $wishlist_meta ); ?>
<?php /* ?>
<ul class="products columns-4">
<?php if( count( $wishlist_items ) > 0 ) :
$added_items = array();
foreach( $wishlist_items as $item ) :
global $product;
$item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
if( in_array( $item['prod_id'], $added_items ) ){
continue;
}
$added_items[] = $item['prod_id'];
$product = wc_get_product( $item['prod_id'] );
$availability = $product->get_availability();
$stock_status = $availability['class'];
if( $product && $product->exists() ) :
?>
<li class="product">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
<?php echo $product->get_image() ?>
<h2 class="woocommerce-loop-product__title"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h2>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</a>
<?php if( $is_user_owner ): ?>
<div class="product-remove">
×
</div>
<?php endif; ?>
<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
<select class="change-wishlist selectBox-">
<option value=""><?php _e( 'Move', 'yith-woocommerce-wishlist' ) ?></option>
<?php
foreach( $users_wishlists as $wl ):
if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
continue;
}
?>
<option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
<?php
$wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
if( $wl['wishlist_privacy'] == 1 ){
$wl_privacy = __( 'Shared', 'yith-woocommerce-wishlist' );
}
elseif( $wl['wishlist_privacy'] == 2 ){
$wl_privacy = __( 'Private', 'yith-woocommerce-wishlist' );
}
else{
$wl_privacy = __( 'Public', 'yith-woocommerce-wishlist' );
}
// echo sprintf( '%s - %s', $wl_title, $wl_privacy );
echo sprintf( '%s', $wl_title );
?>
</option>
<?php
endforeach;
?>
</select>
<?php endif; ?>
</li>
<?php
endif;
endforeach;
else: ?>
<?php endif; ?>
</ul>
<?php */ ?>
<?php ?>
<!-- WISHLIST TABLE -->
<table class="shop_table cart wishlist_table" data-pagination="<?php echo esc_attr( $pagination )?>" data-per-page="<?php echo esc_attr( $per_page )?>" data-page="<?php echo esc_attr( $current_page )?>" data-id="<?php echo $wishlist_id ?>" data-token="<?php echo $wishlist_token ?>">
<?php $column_count = 2; ?>
<thead>
<tr>
<?php if( $show_cb ) : ?>
<th class="product-checkbox">
<input type="checkbox" value="" name="" id="bulk_add_to_cart"/>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $is_user_owner ): ?>
<th class="product-remove"></th>
<?php
$column_count ++;
endif;
?>
<th class="product-thumbnail"></th>
<th class="product-name">
<span class="nobr"><?php echo apply_filters( 'yith_wcwl_wishlist_view_name_heading', __( 'Product Name', 'yith-woocommerce-wishlist' ) ) ?></span>
</th>
<?php if( $show_price ) : ?>
<th class="product-price">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_view_price_heading', __( 'Unit Price', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $show_stock_status ) : ?>
<th class="product-stock-status">
<span class="nobr">
<?php echo apply_filters( 'yith_wcwl_wishlist_view_stock_heading', __( 'Stock Status', 'yith-woocommerce-wishlist' ) ) ?>
</span>
</th>
<?php
$column_count ++;
endif;
?>
<?php if( $show_last_column ) : ?>
<th class="product-move"></th>
<?php
$column_count ++;
endif;
?>
</tr>
</thead>
<tbody>
<?php
if( count( $wishlist_items ) > 0 ) :
$added_items = array();
foreach( $wishlist_items as $item ) :
global $product;
$item['prod_id'] = yit_wpml_object_id ( $item['prod_id'], 'product', true );
if( in_array( $item['prod_id'], $added_items ) ){
continue;
}
$added_items[] = $item['prod_id'];
$product = wc_get_product( $item['prod_id'] );
$availability = $product->get_availability();
$stock_status = $availability['class'];
if( $product && $product->exists() ) :
?>
<tr id="yith-wcwl-row-<?php echo $item['prod_id'] ?>" data-row-id="<?php echo $item['prod_id'] ?>">
<?php if( $show_cb ) : ?>
<td class="product-checkbox">
<input type="checkbox" value="<?php echo esc_attr( $item['prod_id'] ) ?>" name="add_to_cart[]" <?php echo ( ! $product->is_type( 'simple' ) ) ? 'disabled="disabled"' : '' ?>/>
</td>
<?php endif ?>
<?php if( $is_user_owner ): ?>
<td class="product-remove">
<div>
×
</div>
</td>
<?php endif; ?>
<td class="product-thumbnail">
<a href="<?php echo esc_url( get_permalink( apply_filters( 'woocommerce_in_cart_product', $item['prod_id'] ) ) ) ?>">
<!-- THIS IS GRABBING THE IMAGE SUCCESSFULLY -->
<?php echo $product->get_image() ?>
<h2 class="product-name"><?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?></h2>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</a>
</td>
<?php /* ?>
<td class="product-name">
<?php echo apply_filters( 'woocommerce_in_cartproduct_obj_title', $product->get_title(), $product ) ?>
<?php do_action( 'yith_wcwl_table_after_product_name', $item ); ?>
</td>
<?php */ ?>
<?php if( $show_price ) : ?>
<td class="product-price">
<?php
$base_product = $product->is_type( 'variable' ) ? $product->get_variation_regular_price( 'max' ) : $product->get_price();
echo $base_product ? $product->get_price_html() : apply_filters( 'yith_free_text', __( 'Free!', 'yith-woocommerce-wishlist' ) );
?>
</td>
<?php endif ?>
<?php if( $show_stock_status ) : ?>
<td class="product-stock-status">
<?php echo $stock_status == 'out-of-stock' ? '<span class="wishlist-out-of-stock">' . __( 'Out of Stock', 'yith-woocommerce-wishlist' ) . '</span>' : '<span class="wishlist-in-stock">' . __( 'In Stock', 'yith-woocommerce-wishlist' ) . '</span>'; ?>
</td>
<?php endif ?>
<?php if( $show_last_column ): ?>
<td class="product-move">
<!-- Date added -->
<?php
if( $show_dateadded && isset( $item['dateadded'] ) ):
echo '<span class="dateadded">' . sprintf( __( 'Added on : %s', 'yith-woocommerce-wishlist' ), date_i18n( get_option( 'date_format' ), strtotime( $item['dateadded'] ) ) ) . '</span>';
endif;
?>
<!-- Add to cart button -->
<?php if( $show_add_to_cart && isset( $stock_status ) && $stock_status != 'out-of-stock' ): ?>
<?php woocommerce_template_loop_add_to_cart(); ?>
<?php endif ?>
<!-- Change wishlist -->
<?php if( $available_multi_wishlist && is_user_logged_in() && count( $users_wishlists ) > 1 && $move_to_another_wishlist && $is_user_owner ): ?>
<div class="product-move-trigger">
<!-- <img src="<?php echo get_template_directory_uri(); ?>/assets/img/plus-white.svg" alt="" class=""> -->
</div>
<div class="product-move-dropdown">
<h3>Move to Board</h3>
<select class="change-wishlist selectBox- select">
<option value=""><?php _e( 'Choose...', 'yith-woocommerce-wishlist' ) ?></option>
<?php
foreach( $users_wishlists as $wl ):
if( $wl['wishlist_token'] == $wishlist_meta['wishlist_token'] ){
continue;
}
?>
<option value="<?php echo esc_attr( $wl['wishlist_token'] ) ?>">
<?php
$wl_title = ! empty( $wl['wishlist_name'] ) ? esc_html( $wl['wishlist_name'] ) : esc_html( $default_wishlsit_title );
if( $wl['wishlist_privacy'] == 1 ){
$wl_privacy = __( 'Shared', 'yith-woocommerce-wishlist' );
}
elseif( $wl['wishlist_privacy'] == 2 ){
$wl_privacy = __( 'Private', 'yith-woocommerce-wishlist' );
}
else{
$wl_privacy = __( 'Public', 'yith-woocommerce-wishlist' );
}
if ( $wl_title == 'My Materials' ) {
$wl_title = 'Main board';
}
// echo sprintf( '%s - %s', $wl_title, $wl_privacy );
echo sprintf( '%s', $wl_title );
?>
</option>
<?php
endforeach;
?>
</select>
</div>
<?php endif; ?>
<!-- Remove from wishlist -->
<?php if( $is_user_owner && $repeat_remove_button ): ?>
<?php _e( 'Remove', 'yith-woocommerce-wishlist' ) ?>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php
endif;
endforeach;
else: ?>
<tr class="empty">
<td colspan="<?php echo esc_attr( $column_count ) ?>" class="wishlist-empty"><?php echo apply_filters( 'yith_wcwl_no_product_to_remove_message', __( 'No items have been added to this board yet', 'yith-woocommerce-wishlist' ) ) ?></td>
</tr>
<?php
endif;
if( ! empty( $page_links ) ) : ?>
<tr class="pagination-row">
<td colspan="<?php echo esc_attr( $column_count ) ?>"><?php echo $page_links ?></td>
</tr>
<?php endif ?>
</tbody>
<tfoot>
<tr>
<td colspan="<?php echo esc_attr( $column_count ) ?>">
<?php if( $show_cb ) : ?>
<div class="custom-add-to-cart-button-cotaniner">
<?php echo apply_filters( 'yith_wcwl_custom_add_to_cart_text', __( 'Add the selected products to the cart', 'yith-woocommerce-wishlist' ) ) ?>
</div>
<?php endif; ?>
<?php if ( $is_user_owner && $show_ask_estimate_button && $count > 0 ): ?>
<div class="ask-an-estimate-button-container">
<a href="<?php echo ( $additional_info || ! is_user_logged_in() ) ? '#ask_an_estimate_popup' : $ask_estimate_url ?>" class="btn button ask-an-estimate-button" <?php echo ( $additional_info ) ? 'data-rel="prettyPhoto[ask_an_estimate]"' : '' ?> >
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
</a>
</div>
<?php endif; ?>
<?php
do_action( 'yith_wcwl_before_wishlist_share', $wishlist_meta );
if ( is_user_logged_in() && $is_user_owner && ! $is_private && $share_enabled ){
yith_wcwl_get_template( 'share.php', $share_atts );
}
do_action( 'yith_wcwl_after_wishlist_share', $wishlist_meta );
?>
</td>
</tr>
</tfoot>
</table>
<?php ?>
<?php wp_nonce_field( 'yith_wcwl_edit_wishlist_action', 'yith_wcwl_edit_wishlist' ); ?>
<?php if( ! $is_default ): ?>
<input type="hidden" value="<?php echo $wishlist_token ?>" name="wishlist_id" id="wishlist_id">
<?php endif; ?>
<?php do_action( 'yith_wcwl_after_wishlist', $wishlist_meta ); ?>
</form>
<?php do_action( 'yith_wcwl_after_wishlist_form', $wishlist_meta ); ?>
<?php if( $show_ask_estimate_button && ( ! is_user_logged_in() || $additional_info ) ): ?>
<div id="ask_an_estimate_popup">
<form action="<?php echo $ask_estimate_url ?>" method="post" class="wishlist-ask-an-estimate-popup">
<?php if( ! is_user_logged_in() ): ?>
<label for="reply_email"><?php echo apply_filters( 'yith_wcwl_ask_estimate_reply_mail_label', __( 'Your email', 'yith-woocommerce-wishlist' ) ) ?></label>
<input type="email" value="" name="reply_email" id="reply_email">
<?php endif; ?>
<?php if( ! empty( $additional_info_label ) ):?>
<label for="additional_notes"><?php echo esc_html( $additional_info_label ) ?></label>
<?php endif; ?>
<textarea id="additional_notes" name="additional_notes"></textarea>
<button class="btn button ask-an-estimate-button ask-an-estimate-button-popup" >
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_icon', '<i class="fa fa-shopping-cart"></i>' )?>
<?php echo apply_filters( 'yith_wcwl_ask_an_estimate_text', __( 'Ask for an estimate', 'yith-woocommerce-wishlist' ) ) ?>
</button>
</form>
</div>
<?php endif; ?>
I know this script cannot be directly copied as it is looking through product variables knowing which product it is looking through, I need to write something similar that will look inside the wishlist instead of inside the product.
I think I know what I need to do, I just have no idea how to do it.
I have tried simple stuff I predicted wouldn't work before even implementing it. Trying to guess shortcodes / scouring the web for a list of shortcodes.
Edit
Attempting to achieve this using 'simplehtmldom'...
I have downloaded and installed simplehtmldom then called it into the file:
<?php
$simplehtmldom = get_template_directory() . "/simplehtmldom/simple_html_dom.php";
include_once($simplehtmldom);
?>
Then gone on to try find the image within the wishlist by gathering the src of the first product in that wishlist:
<?php
$boardlink = YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] );
$html = file_get_html($boardlink);
$wishlistimage = $html->find('.attachment-woocommerce_thumbnail', 0)->src;
?>
The variable $boardlink value has been taken from the href within the section:
<a title="<?php echo $wishlist['wishlist_name'] ?>" class="wishlist-anchor" href="<?php echo YITH_WCWL()->get_wishlist_url( 'view' . '/' . $wishlist['wishlist_token'] ) ?>">
So technically should / could work...
However, I get a range of errors:
Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php on line 136
Warning: file_get_contents(): Failed to enable crypto in /home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php on line 136
Warning: file_get_contents(https://development.example.com/my-materials/view/9OW01M6785H9/): failed to open stream: operation failed in /home/example/public_html/development/wp-content/themes/bolt/simplehtmldom/simple_html_dom.php on line 136
This site doesn't have a valid SSL as it is just a staging dev site. The live site does have an SSL.
I think the main issue is with the wishlists being private to the user, I don't think we are able to scrape from these pages.

Wordpress - How to show header on every page?

I'm working on a Wordpress site and I have a header image on the homepage. It's only showing up on the homepage but I need it to show on every page. I found this code in the header.php file which I believe needs to be changed, but I'm not very familiar with php.
This is the code for the header image in the header.php file:
<?php $disable_page_title = get_post_meta( get_the_ID(), 'minimal_portfolio_page_title', true );
if( $disable_page_title !== 'on' ): ?>
<?php if( !is_front_page()): ?>
<section class="page-header jumbotron <?php if ( get_header_image() ) : ?>bg-image<?php endif; ?>" <?php if ( get_header_image() ) : ?> style="background-image:url('<?php echo esc_url( get_header_image() ); ?>');" <?php endif; ?>>
<?php if ( get_header_image() ) : ?><span class="bg-overlay"></span><?php endif; ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="title-wrap">
<?php if( is_page() || is_single() ){ ?>
<h2 class="page-title"><?php echo esc_html( get_the_title() ); ?></h2>
<?php } elseif( is_search() ){ ?>
<?php /* translators: %s: search term */
$page_title = sprintf( esc_html__( 'Search Results for: %s', 'minimal-portfolio' ), get_search_query() );
?>
<h2 class="page-title"><?php echo esc_html( $page_title ); ?></h2>
<?php }elseif( is_404() ){ ?>
<h2 class="page-title"><?php echo esc_html( 'Page Not Found: 404', 'minimal-portfolio' ); ?></h2>
<?php }elseif( is_home() ){ ?>
<h2 class="page-title"><?php single_post_title(); ?></h2>
<?php } else{
the_archive_title( '<h2 class="page-title">', '</h2>' );
}
if( $minimal_portfolio_breadcrumb_status ):
minimal_portfolio_breadcrumbs();
endif;
?>
</div>
</div>
</div>
</div>
</section>
<?php endif;
endif; ?>
Thank you!
Edit: This is how it shows on all pages but the home page. But I would like it to show the full header instead of only a section of it with the page title.
Header
This is the home page, where it shows the full header and how I'd like it to show on every page instead of how it does in the image above.
Home Header
You are not familiar with PHP so you can use this plugin for the header image.
https://wordpress.org/plugins/unique-headers/
I think its work for you
Remove the below-attached code from header.php
<?php $disable_page_title = get_post_meta( get_the_ID(), 'minimal_portfolio_page_title', true );
if( $disable_page_title !== 'on' ): ?>
<?php if( !is_front_page()): ?>
<section class="page-header jumbotron <?php if ( get_header_image() ) : ?>bg-image<?php endif; ?>" <?php if ( get_header_image() ) : ?> style="background-image:url('<?php echo esc_url( get_header_image() ); ?>');" <?php endif; ?>>
<?php if ( get_header_image() ) : ?><span class="bg-overlay"></span><?php endif; ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="title-wrap">
<?php if( is_page() || is_single() ){ ?>
<h2 class="page-title"><?php echo esc_html( get_the_title() ); ?></h2>
<?php } elseif( is_search() ){ ?>
<?php /* translators: %s: search term */
$page_title = sprintf( esc_html__( 'Search Results for: %s', 'minimal-portfolio' ), get_search_query() );
?>
<h2 class="page-title"><?php echo esc_html( $page_title ); ?></h2>
<?php }elseif( is_404() ){ ?>
<h2 class="page-title"><?php echo esc_html( 'Page Not Found: 404', 'minimal-portfolio' ); ?></h2>
<?php }elseif( is_home() ){ ?>
<h2 class="page-title"><?php single_post_title(); ?></h2>
<?php } else{
the_archive_title( '<h2 class="page-title">', '</h2>' );
}
if( $minimal_portfolio_breadcrumb_status ):
minimal_portfolio_breadcrumbs();
endif;
?>
</div>
</div>
</div>
</div>
</section>
<?php endif;
endif; ?>
And add this code in your page.php
<?php if( get_header_image() ) : ?>
<div class="header-banner">
<img src="<?php header_image(); ?>" width="<?php echo absint( get_custom_header()->width ); ?>" height="<?php echo absint( get_custom_header()->height ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>">
</div>

Wordpress Blog page only showing one post

Im having an issue with a theme i've been customizing. My blog post only shows ( 1 ) post and i cant seem to fix the issue in Admin > Reading > Blog pages show at most. The Value only stays at "1" even after save. The code i have here is in the Loop.php
<?php ?>
<article class="primary-content">
<?php $firstClass='first-post' ; ?>
<?php /* If there are no posts to display, such as an empty archive page */ ?>
<?php if ( ! have_posts() ) : ?>
<article role="main" class="the-content">
<h1><?php _e( '404 - I'm sorry but the page can't be found' ); ?></h1>
<p>Please try searching again or head back to the homepage.</p>
</article>
<?php endif; ?>
<?php ?>
<?php if (is_home()): ?>
<h1>
<?php if ( is_day() ) : ?><?php printf( __( '<span>Daily Archive</span> %s' ), get_the_date() ); ?>
<?php elseif ( is_month() ) : ?><?php printf( __( '<span>Monthly Archive</span> %s' ), get_the_date('F Y') ); ?>
<?php elseif ( is_year() ) : ?><?php printf( __( '<span>Yearly Archive</span> %s' ), get_the_date('Y') ); ?>
<?php elseif ( is_category() ) : ?><?php echo single_cat_title(); ?>
<?php elseif ( is_search() ) : ?><?php printf( __( 'Search Results for: %s' ), '<span>' . get_search_query() . '</span>' ); ?>
<?php elseif ( is_home() ) : ?>Blog<?php else : ?>
<?php endif; ?>
</h1>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php /* How to display standard posts and search results */ ?>
<article class="article-archive <?php echo $firstClass; ?>" id="post-<?php the_ID(); ?>">
<?php $firstClass="" ; ?>
<?php ?>
<?php if (is_front_page()) { ?>
<div class="home-summary">
<?php } else { ?>
<div class="entry-summary">
<?php } ?>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( '%s' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
<?php the_post_thumbnail( 'flozo-thumb');?>
</a>
<?php if (is_front_page()) { ?>
<h1><?php the_title(); ?></h1>
<?php } else { ?>
<h2><?php the_title(); ?></h2>
<?php } ?>
<?php the_excerpt(); ?>
<?php if ( is_home() ) : ?>
<p class="entry-meta">
<time datetime="<?php the_time('l, F jS, Y') ?>" pubdate>
<?php the_time( 'l jS F Y') ?>
</time>
</p>
<?php endif; ?>
</div>
</article>
<?php /*?>
<?php comments_template( '', true ); ?>
<?php */?>
<?php endwhile; // End the loop. Whew. ?>
<?php /* Display navigation to next/previous pages when applicable */ ?>
<?php if ( $wp_query->max_num_pages > 1 ) : ?>
<div class="navigation">
<div class="nav-previous">
<?php next_posts_link( __( 'Older posts' ) ); ?>
</div>
<div class="nav-next">
<?php previous_posts_link( __( 'Newer posts' ) ); ?>
</div>
</div>
<!-- #nav-below -->
<?php endif; ?>
</article>
Any and all help with be greatly appreciated! Sorry if this was posted already.
L

Wordpress: Comments: Submitting a comment opens a related post

I have a problem with my comments form.
Submitting a comment leads to open a related post.
Here's my comments.php:
<?php
if ( post_password_required() ) :
echo '<h3 class="comments-header">' . __('Password Protected', 'buddypress') . '</h3>';
echo '<p class="alert password-protected">' . __('Enter the password to view comments.', 'buddypress') . '</p>';
return;
endif;
if ( is_page() && !have_comments() && !comments_open() && !pings_open() )
return;
?>
<?php if ( have_comments() ) : ?>
<div id="comments">
<?php
// Only include comments
$numTrackBacks = 0; $numComments = 0;
foreach ( (array)$comments as $comment )
if ( 'comment' != get_comment_type() )
$numTrackBacks++;
else
$numComments++;
?>
<h3 id="comments">
<?php
printf( _n( '1 Kommentar', '%1$s Kommentare', $numComments, 'buddypress' ),
number_format_i18n( $numComments ), '<em>' . get_the_title() . '</em>' );
?>
</h3>
<?php do_action( 'bp_before_blog_comment_list' ) ?>
<ol class="commentlist">
<?php wp_list_comments() ; ?>
</ol><!-- .comment-list -->
<?php do_action( 'bp_after_blog_comment_list' ) ?>
<?php if ( get_option( 'page_comments' ) ) : ?>
<div class="comment-navigation paged-navigation">
<?php paginate_comments_links(); ?>
</div>
<?php endif; ?>
</div><!-- #comments -->
<?php else : ?>
<?php if ( pings_open() && !comments_open() && is_single() ) : ?>
<p class="comments-closed pings-open">
<?php printf( __('Comments are closed, but trackbacks and pingbacks are open.', 'buddypress'), trackback_url( '0' ) ); ?>
</p>
<?php elseif ( !comments_open() && is_single() ) : ?>
<p class="comments-closed">
<?php _e('Keine Kommentare erlaubt.', 'buddypress'); ?>
</p>
<?php endif; ?>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<div id="respond">
<div class="comment-avatar-box">
<div class="avb">
<?php if ( bp_loggedin_user_id() ) : ?>
<a href="<?php echo bp_loggedin_user_domain() ?>">
<?php echo get_avatar( bp_loggedin_user_id(), 50 ); ?>
</a>
<?php else : ?>
<?php echo get_avatar( 0, 50 ); ?>
<?php endif; ?>
</div>
</div>
<div class="comment-content">
<h3 id="reply" class="comments-header">
<?php comment_form_title( __( 'Leave a Reply', 'buddypress' ), __( 'Leave a Reply to %s', 'buddypress' ), true ); ?>
</h3>
<p id="cancel-comment-reply">
<?php cancel_comment_reply_link( __( 'Click here to cancel reply.', 'buddypress' ) ); ?>
</p>
<?php if ( get_option( 'comment_registration' ) && !$user_ID ) : ?>
<p class="alert">
<?php printf( __('You must be logged in to post a comment.', 'buddypress'), wp_login_url( get_permalink() ) ); ?>
</p>
<?php else : ?>
<?php do_action( 'bp_before_blog_comment_form' ) ?>
<form action="<?php echo site_url( 'wp-comments-post.php' ) ?>" method="post" id="commentform" class="standard-form">
<?php if ( $user_ID ) : ?>
<p class="log-in-out">
<?php printf( __('Logged in as %2$s.', 'buddypress'), bp_loggedin_user_domain(), $user_identity ); ?> <?php _e('Log out →', 'buddypress'); ?>
</p>
<?php else : ?>
<?php $req = get_option( 'require_name_email' ); ?>
<p class="form-author">
<label for="author"><?php _e('Name', 'buddypress'); ?> <?php if ( $req ) : ?><span class="required"><?php _e('*', 'buddypress'); ?></span><?php endif; ?></label>
<input type="text" class="text-input" name="author" id="author" value="<?php echo $comment_author; ?>" size="40" tabindex="1" />
</p>
<p class="form-email">
<label for="email"><?php _e('Email', 'buddypress'); ?> <?php if ( $req ) : ?><span class="required"><?php _e('*', 'buddypress'); ?></span><?php endif; ?></label>
<input type="text" class="text-input" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="40" tabindex="2" />
</p>
<p class="form-url">
<label for="url"><?php _e('Website', 'buddypress'); ?></label>
<input type="text" class="text-input" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="40" tabindex="3" />
</p>
<?php endif; ?>
<p class="form-textarea">
<label for="comment"><?php _e('Comment', 'buddypress'); ?></label>
<textarea name="comment" id="comment" cols="60" rows="10" tabindex="4"></textarea>
</p>
<?php do_action( 'bp_blog_comment_form' ) ?>
<p class="form-submit">
<input class="submit-comment button" name="submit" type="submit" id="submit" tabindex="5" value="<?php _e('Submit', 'buddypress'); ?>" />
<?php comment_id_fields(); ?>
</p>
<div class="comment-action">
<?php do_action( 'comment_form', $post->ID ); ?>
</div>
</form>
<?php do_action( 'bp_after_blog_comment_form' ) ?>
<?php endif; ?>
</div><!-- .comment-content -->
</div><!-- #respond -->
<?php endif; ?>
<?php if ( $numTrackBacks ) : ?>
<div id="trackbacks">
<span class="title"><?php the_title() ?></span>
<?php if ( 1 == $numTrackBacks ) : ?>
<h3><?php printf( __( '%d Trackback', 'buddypress' ), $numTrackBacks ) ?></h3>
<?php else : ?>
<h3><?php printf( __( '%d Trackbacks', 'buddypress' ), $numTrackBacks ) ?></h3>
<?php endif; ?>
<ul id="trackbacklist">
<?php foreach ( (array)$comments as $comment ) : ?>
<?php if ( get_comment_type() != 'comment' ) : ?>
<li><h5><?php comment_author_link() ?></h5><em>on <?php comment_date() ?></em></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
An answer would be appreciated
Update:
My single.php:
<?php get_header(); ?>
<!-- LAESST DEN HEADER ERSCHEINEN -->
<div id="main">
<!-- DAS IST DER LOOP! HIER WIRD DER BEFEHL GEGEBEN, DEN INHALT ANZUZEIGEN (ARTIKEL ETC) -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2> <!-- DIESER BEFEHL ZEIGT UND VERLINKT DIE ARTIKEL UEBERSCHRIFT -->
<div class="entry">
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<div class="author-box">
<p><?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?></p>
<p><?php printf( __( 'Geschrieben von %s', 'buddypress' ), bp_core_get_userlink( $post->post_author ) ) ?> am <?php the_time('j. F Y'); ?> um <?php the_time(); ?></p>
<p> Kategorie(n): <?php the_category(', '); ?> </p>
</div>
<div id="related-posts"
<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'showposts'=>3, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '<h3>Das könnte dich auch interessieren</h3><ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<li><?php the_title(); ?></li>
<?php
}
echo '</ul>';
}
}
?>
</div>
<!--"NEXT POST" BZW "PREVIOUS POST" NAVIGATION -->
<p align="center"><?php next_posts_link('« Ältere Einträge') ?> <?php previous_posts_link('Neuere Einträge »') ?></p>
<?php endif; ?>
<?php comments_template(); ?> <!-- LAESST DAS KOMMENTARFELD ERSCHEINEN -->
</div><!-- main -->
<div id="sidebar">
<?php get_sidebar(); ?>
<!-- LAESST DIE SIDEBAR ERSCHEINEN -->
</div><!-- sidebar -->
<?php get_footer(); ?>
<!-- DIESER BEFEHL LAESST DEN FOOTER ERSCHEINEN -->
But why is it displayed incorrectly?
The only point in your code that could be responsible for your problem, as far as I can see, is at:
<div class="comment-action">
<?php do_action( 'comment_form', $post->ID ); ?>
</div>
$post->ID should hold the id of the current post or be null. If there is a problem with $post, it will be on the page that calls this comments template, single.php probably. You could try changing your current single.php file for the twentyten one and see if that solves the problem. Or post here that single.php file contents so we can check it.
EDIT:
On the single.php file, you have a new query being executed to get the related posts:
$args=array(
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'showposts'=>3, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
This code is populating the $post variable with each of the related posts found, so once that code is done you will have the $post var holding the last post of the related posts retrieved with that query.
Easiest solution: cut the code for the related posts functionality (everything inside de "related-posts" div, including the opening and closing div tags) and paste it just before the </div><!-- main --> so it doesn't affect the comments or navigation parts.

Categories