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

Divi Child Theme Setup #4

Open
wants to merge 1 commit 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
56 changes: 56 additions & 0 deletions divi-collectionpress/collectionpress/author_display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Template file of Collection Press To Author Display
* @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/author_display.php"
* */
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('et_pb_post'); ?>>
<?php
$post_format = et_pb_post_format();
$thumb = '';

$width = (int) apply_filters('et_pb_index_blog_image_width', 1080);

$height = (int) apply_filters('et_pb_index_blog_image_height', 675);
$classtext = 'et_pb_post_main_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];

et_divi_post_format_content();
if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) {
if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) :
printf(
'<div class="et_main_video_container">
%1$s
</div>',
$first_video
);
elseif ( ! in_array( $post_format, array( 'gallery' ) ) && 'on' === et_get_option( 'divi_thumbnails_index', 'on' ) && '' !== $thumb ) : ?>
<a href="<?php the_permalink(); ?>">
<?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height ); ?>
</a>
<?php
elseif ( 'gallery' === $post_format ) :
et_pb_gallery_images();
endif;
} ?>

<?php if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) : ?>
<?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) ) : ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endif; ?>

<?php
et_divi_post_meta();

if ( 'on' !== et_get_option( 'divi_blog_style', 'false' ) || ( is_search() && ( 'on' === get_post_meta( get_the_ID(), '_et_pb_use_builder', true ) ) ) ) {
truncate_post( 270 );
} else {
the_content();
}
?>
<?php endif; ?>
</article> <!-- .et_pb_post -->
56 changes: 56 additions & 0 deletions divi-collectionpress/collectionpress/author_display_posts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Template file of Collection Press To Author Display
* @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/author_display.php"
* */
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('et_pb_post'); ?>>
<?php
$post_format = et_pb_post_format();
$thumb = '';

$width = (int) apply_filters('et_pb_index_blog_image_width', 1080);

$height = (int) apply_filters('et_pb_index_blog_image_height', 675);
$classtext = 'et_pb_post_main_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
$thumb = $thumbnail["thumb"];

et_divi_post_format_content();
if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) {
if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) :
printf(
'<div class="et_main_video_container">
%1$s
</div>',
$first_video
);
elseif ( ! in_array( $post_format, array( 'gallery' ) ) && 'on' === et_get_option( 'divi_thumbnails_index', 'on' ) && '' !== $thumb ) : ?>
<a href="<?php the_permalink(); ?>">
<?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height ); ?>
</a>
<?php
elseif ( 'gallery' === $post_format ) :
et_pb_gallery_images();
endif;
} ?>

<?php if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) : ?>
<?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) ) : ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endif; ?>

<?php
et_divi_post_meta();

if ( 'on' !== et_get_option( 'divi_blog_style', 'false' ) || ( is_search() && ( 'on' === get_post_meta( get_the_ID(), '_et_pb_use_builder', true ) ) ) ) {
truncate_post( 270 );
} else {
the_content();
}
?>
<?php endif; ?>
</article> <!-- .et_pb_post -->
104 changes: 104 additions & 0 deletions divi-collectionpress/collectionpress/cp_author_list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php
/**
* Template Name: CP Author List
* Template file of Collection Press To Author Display
* @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_author_list.php"
* */

get_header();
$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_status" =>"publish",
"orderby" =>"modified",
"order" =>"DESC",
"posts_per_page" =>$posts_per_page,
"cache_results" => false,
"paged" => $paged));
$found_posts =$author_results->found_posts;
$total_pages =$author_results->max_num_pages;
?>

<div id="main-content">
<div class="container">
<div id="content-area" class="clearfix">
<div id="left-area">
<?php if($author_results->have_posts()): ?>
<?php while ( $author_results->have_posts() ) : $author_results->the_post(); ?>
<?php $post_format = et_pb_post_format(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class( 'et_pb_post' ); ?>>

<?php
$thumb = '';

$width = (int) apply_filters( 'et_pb_index_blog_image_width', 1080 );

$height = (int) apply_filters( 'et_pb_index_blog_image_height', 675 );
$classtext = 'et_pb_post_main_image';
$titletext = get_the_title();
$thumbnail = get_thumbnail( $width, $height, $classtext, $titletext, $titletext, false, 'Blogimage' );
$thumb = $thumbnail["thumb"];

et_divi_post_format_content();

if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) {
if ( 'video' === $post_format && false !== ( $first_video = et_get_first_video() ) ) :
printf(
'<div class="et_main_video_container">
%1$s
</div>',
$first_video
);
elseif ( ! in_array( $post_format, array( 'gallery' ) ) && 'on' === et_get_option( 'divi_thumbnails_index', 'on' ) && '' !== $thumb ) : ?>
<a href="<?php the_permalink(); ?>">
<?php print_thumbnail( $thumb, $thumbnail["use_timthumb"], $titletext, $width, $height ); ?>
</a>
<?php
elseif ( 'gallery' === $post_format ) :
et_pb_gallery_images();
endif;
} ?>

<?php if ( ! in_array( $post_format, array( 'link', 'audio', 'quote' ) ) ) : ?>
<?php if ( ! in_array( $post_format, array( 'link', 'audio' ) ) ) : ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endif; ?>

<?php
et_divi_post_meta();

if ( 'on' !== et_get_option( 'divi_blog_style', 'false' ) || ( is_search() && ( 'on' === get_post_meta( get_the_ID(), '_et_pb_use_builder', true ) ) ) ) {
truncate_post( 270 );
} else {
the_content();
}
?>
<?php endif; ?>
</article> <!-- .et_pb_post -->

<?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' =>'?paged=%#%',
'prev_text' =>__('&laquo;'),
'next_text' =>__('&raquo;'),
'current' =>max(1, get_query_var('paged')),
'total' =>$total_pages
) );
?>
</div>
<?php endif; ?>
</div> <!-- #left-area -->

<?php get_sidebar(); ?>
</div> <!-- #content-area -->
</div> <!-- .container -->
</div> <!-- #main-content -->

<?php get_footer(); ?>
43 changes: 43 additions & 0 deletions divi-collectionpress/collectionpress/cp_item.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
/**
* Template Name: CP Item
* 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']!='' ){
$item_id = $_GET['item_id'];
$cp_author = new CP_Author();
//~ do_action( 'show_item_details', $item_id );
$response = $cp_author->cp_get_item_by_id($item_id);
}
}
?>


<div id="main-content">
<div class="container">
<div id="content-area" class="clearfix">
<div id="left-area">
<?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 endif; ?>
</div> <!-- #left-area -->

<?php get_sidebar(); ?>
</div> <!-- #content-area -->
</div> <!-- .container -->
</div> <!-- #main-content -->

<?php get_footer(); ?>
56 changes: 56 additions & 0 deletions divi-collectionpress/collectionpress/item_display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* Template file of Collection Press To Author Display
* @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/item_display.php"
* */
?>
<ul>
<?php foreach($response->response->docs as $doc): ?>
<?php $parts = array();?>
<li>
<?php if (is_array($title = $doc->title)): ?>
<?php $title = array_shift($title); ?>

<?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 $parts[] = array_shift($publisher); ?>
<?php endif; ?>

<?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
$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
$big = 999999999; // need an unlikely integer
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; ?>
10 changes: 10 additions & 0 deletions divi-collectionpress/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#main-header{
-webkit-box-shadow:none !important;
-moz-box-shadow:none !important;
box-shadow:none !important;
}

#main-content {
padding-top: 15px;
}

13 changes: 13 additions & 0 deletions divi-collectionpress/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );

function my_enqueue_assets() {

wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
// enqueue child styles
wp_enqueue_style('custom-theme', get_stylesheet_directory_uri() .'/custom.css', array('parent-style'));

}

?>
Binary file added divi-collectionpress/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions divi-collectionpress/sidebar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
if ( ( is_single() || is_page() ) && 'et_full_width_page' === get_post_meta( get_queried_object_id(), '_et_pb_page_layout', true ) )
return;

if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
<div class="karc-cp-sidebar">
<?php dynamic_sidebar( 'sidebar-1' ); ?>
</div> <!-- end #sidebar -->
<?php endif; ?>
Loading