Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions bootstrap/collectionpress/author_display.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
</a>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php
the_content();
?>

<?php if (has_post_thumbnail()) {
the_post_thumbnail();
} ?>
</a>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
</article> <!-- .et_pb_post -->
17 changes: 7 additions & 10 deletions bootstrap/collectionpress/author_display_posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@
* */
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
</a>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php
the_content();
?>

<a href="<?php the_permalink(); ?>">
<?php if (has_post_thumbnail()) {
the_post_thumbnail();
} ?>
</a>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
</article> <!-- .et_pb_post -->
21 changes: 12 additions & 9 deletions bootstrap/collectionpress/cp_author_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
$posts_per_page = get_option("post_per_page");
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$author_results = new WP_Query(array(
"post_type" =>"cp_authors",
"post_type" =>"cp_authors",
"post_status" =>"publish",
"orderby" =>"modified",
"order" =>"DESC",
Expand All @@ -26,32 +26,35 @@
<div class="container">
<div id="content-area" class="clearfix">
<div class="content-wrap">
<?php if($author_results->have_posts()): ?>
<?php while ( $author_results->have_posts() ) : $author_results->the_post(); ?>
<?php if ($author_results->have_posts() ): ?>
<?php while ($author_results->have_posts()) : ?>
<?php $author_results->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
} ?>
<?php if (has_post_thumbnail()) :
the_post_thumbnail();
endif; ?>
</a>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
</article> <!-- .et_pb_post -->

<?php endwhile; ?>
<div class="pagination">
<?php
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
echo paginate_links(array(
'base' =>str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' =>'?paged=%#%',
'prev_text' =>__('&laquo;'),
'next_text' =>__('&raquo;'),
'current' =>max(1, get_query_var('paged')),
'total' =>$total_pages
) );
));
?>
</div>
<?php else : ?>
<p><?php echo __('No results found.', 'cpress'); ?></p>
<?php endif; ?>
</div> <!-- #left-area -->

Expand Down
20 changes: 10 additions & 10 deletions bootstrap/collectionpress/cp_item.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
/**
* Template Name: CP Item
* Template file of Collection Press To Item show
* Template Name: CP Item List
* Template file of Collection Press To Item show
* @author Avinash
* You can add this file to theme folder by creating collectionpress folder and paste this file there.
* Path will be "<theme_name>/collectionpress/cp_item.php"
* */

get_header();
if (isset($_GET) && isset($_GET['item_id'])){
if ( $_GET['item_id']!='' ){
if (isset($_GET) && isset($_GET['item_id'])) {
if ($_GET['item_id']!='') {
$item_id = $_GET['item_id'];
$cp_author = new CP_Author();
//~ do_action( 'show_item_details', $item_id );
Expand All @@ -23,19 +23,19 @@
<div class="container">
<div id="content-area" class="clearfix">
<div class="content-wrap">
<?php if(isset($response) && $response!=''): ?>
<?php foreach($response->metadata as $md): ?>
<?php if (isset($response) && $response!='') : ?>
<?php foreach ($response->metadata as $md) : ?>

<p><?php echo $md->element; ?></p>
<p><?php echo $md->qualifier; ?></p>
<p><?php echo $md->value; ?></p>

<?php endforeach;?>

<?php endforeach;?>
<?php else: ?>
<p><?php echo __("Item Id is incorrect!", 'cpress') ?></p>
<?php endif; ?>
</div> <!-- #left-area -->

<?php get_sidebar(); ?>
<?php get_sidebar(); ?>
</div> <!-- #content-area -->
</div> <!-- .container -->
</div> <!-- #main-content -->
Expand Down
28 changes: 14 additions & 14 deletions bootstrap/collectionpress/item_display.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,50 @@
* */
?>
<ul>
<?php foreach($response->response->docs as $doc): ?>
<?php foreach ($response->response->docs as $doc) : ?>
<?php $parts = array();?>
<li>
<?php if (is_array($title = $doc->title)): ?>
<?php if (is_array($title = $doc->title)) : ?>
<?php $title = array_shift($title); ?>

<?php if ($handle = $doc->handle): ?>
<?php if ($handle = $doc->handle) : ?>
<?php $url = add_query_arg("item_id",$doc->{"search.resourceid"},get_permalink($page_id)); ?>
<?php $title = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title); ?>
<?php endif; ?>
<?php $parts[] = $title; ?>
<?php endif; ?>

<?php if (is_array($publisher = &$doc->{"dc.publisher"})): ?>
<?php if (is_array($publisher = &$doc->{"dc.publisher"})) : ?>
<?php $parts[] = array_shift($publisher); ?>
<?php endif; ?>

<?php if (is_array($dateIssued = $doc->dateIssued)): ?>
<?php if (is_array($dateIssued = $doc->dateIssued)) : ?>
<?php $parts[] = array_shift($dateIssued); ?>
<?php endif; ?>

<?php echo implode(", ", $parts); ?>
</li>
<?php endforeach; ?>
</ul>
<?php if ($limit): ?>
<?php if ($limit) : ?>
<?php
$total_count = $response->response->numFound;
$start_page = $response->response->start;
$limit = $response->responseHeader->params->rows;
$total_results = count($response->response->docs);
$total_pages = ceil($total_count/$limit);
$total_count = $response->response->numFound;
$start_page = $response->response->start;
$limit = $response->responseHeader->params->rows;
$total_results = count($response->response->docs);
$total_pages = ceil($total_count/$limit);
?>
<div class="pagination">
<?php
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
echo paginate_links(array(
'base' =>str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' =>'?paged=%#%',
'prev_text' =>__('&laquo;'),
'next_text' =>__('&raquo;'),
'current' =>max(1, get_query_var('paged')),
'total' =>$total_pages
) );
));
?>
</div>
<?php endif; ?>
158 changes: 80 additions & 78 deletions bootstrap/single-cp_authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,104 +12,106 @@
<div class="container">
<div id="content-area" class="clearfix">
<div class="content-wrap">
<?php while ( have_posts() ) : the_post(); ?>
<?php while (have_posts()) : ?>
<?php the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="post_meta_wrapper">
<h1 class="entry-title"><?php the_title(); ?></h1>

<?php if ( ! post_password_required() ) : ?>
<?php if (! post_password_required()) : ?>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) :
<?php if (has_post_thumbnail()) :
the_post_thumbnail();
endif; ?>
</a>
<?php endif; ?>
</div> <!-- .et_post_meta_wrapper -->

<div class="entry-content">
<?php

the_content();
<div class="entry-content">
<?php
the_content();

wp_link_pages( array( 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'cpress' ), 'after' => '</div>' ) );
?>
</div> <!-- .entry-content -->
wp_link_pages(array('before' => '<div class="page-links">' . esc_html__('Pages:', 'cpress'), 'after' => '</div>'));
?>
</div> <!-- .entry-content -->

<div class="author-items-wrap">
<h3><?php echo __('Author Item&apos;s','cpress') ?></h3>
<div class="author-items-wrap">
<h3><?php echo __('Author Items', 'cpress') ?></h3>

<?php
$show_items = get_post_meta(get_the_ID(),"show_items",true);
$author_keyword = get_post_meta(get_the_ID(),"author_keyword",true);
if ( $show_items=="yes" ){
if ( $author_keyword=='' ){
$author_keyword = get_the_title();
<?php
$show_items = get_post_meta(get_the_ID(), "show_items", true);
$author_keyword = get_post_meta(get_the_ID(), "author_keyword", true);
if ( $show_items=="yes" ){
if ( $author_keyword=='' ){
$author_keyword = get_the_title();
}
echo do_shortcode('[collectionpress author="'.$author_keyword.'"]');
}
echo do_shortcode('[collectionpress author="'.$author_keyword.'"]');
}
?>
</div>
<div class="author-posts-wrap">
<h3><?php echo __('Author Blog Post&apos;s','cpress') ?></h3>
<?php
$show_posts = get_post_meta(get_the_ID(),"show_posts",true);
$cp_related_author = get_post_meta(get_the_ID(),"cp_related_author",true);
if ( $show_posts=="yes" && $cp_related_author!=''):
$aposts=1;
if (isset($_GET) && isset($_GET['aposts'])){
if ( $_GET['aposts']!='' ){
$aposts = $_GET['aposts'];
}
}
$author_posts = new WP_Query(array(
"author" =>$cp_related_author,
"post_type" =>"post",
"post_status" =>"publish",
"orderby" =>"modified",
"order" =>"DESC",
"posts_per_page" =>get_option('posts_per_page'),
"cache_results" => false,
"paged" => $aposts) );
$found_posts =$author_posts->found_posts;
$total_pages =$author_posts->max_num_pages;
if ($author_posts->have_posts()) :
while ($author_posts->have_posts()) : $author_posts->the_post();

if (file_exists(locate_template('collectionpress/author_display_posts.php'))) {
include(locate_template('collectionpress/author_display_posts.php'));
} else {
include(CP_TEMPLATE_PATH.'/collectionpress/author_display_posts.php');
}

endwhile; ?>
<div class="pagination">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
//~ 'base' =>str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' =>'?aposts=%#%',
'prev_text' =>__('&laquo;'),
'next_text' =>__('&raquo;'),
'current' =>max(1, get_query_var('aposts')),
'total' =>$total_pages
) );
wp_reset_postdata();
?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php
$show_posts = get_post_meta(get_the_ID(), "show_posts", true);
$cp_related_author = get_post_meta(get_the_ID(), "cp_related_author", true);
if ($show_posts=="yes" && $cp_related_author!='') : ?>
<div class="author-posts-wrap">
<h3><?php echo __('Author Blog Posts', 'cpress') ?></h3>
<?php
$aposts=1;
if (isset($_GET) && isset($_GET['aposts'])) {
if ($_GET['aposts']!=''){
$aposts = $_GET['aposts'];
}
}
$author_posts = new WP_Query(array(
"author" =>$cp_related_author,
"post_type" =>"post",
"post_status" =>"publish",
"orderby" =>"modified",
"order" =>"DESC",
"posts_per_page" =>get_option('posts_per_page'),
"cache_results" => false,
"paged" => $aposts));
$found_posts =$author_posts->found_posts;
$total_pages =$author_posts->max_num_pages;
if ($author_posts->have_posts()) :
while ($author_posts->have_posts()) :
$author_posts->the_post();

<div class="cp_post_meta_wrapper">
if (file_exists(locate_template('collectionpress/author_display_posts.php'))) {
include(locate_template('collectionpress/author_display_posts.php'));
} else {
include(CP_TEMPLATE_PATH.'/collectionpress/author_display_posts.php');
}

<?php
if ( ( comments_open() || get_comments_number() ) && 'on' == et_get_option( 'divi_show_postcomments', 'on' ) ) {
comments_template( '', true );
}
?>
</div> <!-- .et_post_meta_wrapper -->
</article> <!-- .et_pb_post -->
endwhile; ?>
<div class="pagination">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links(array(
//~ 'base' =>str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
'format' =>'?aposts=%#%',
'prev_text' =>__('&laquo;'),
'next_text' =>__('&raquo;'),
'current' =>max(1, get_query_var('aposts')),
'total' =>$total_pages
));
wp_reset_postdata();
?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="cp_post_meta_wrapper">
<?php
if ((comments_open() || get_comments_number())
&& 'on' == et_get_option('divi_show_postcomments', 'on')) {
comments_template('', true);
}
?>
</div> <!-- .et_post_meta_wrapper -->
</article> <!-- .et_pb_post -->

<?php endwhile; ?>
</div> <!-- #content -->
Expand Down