Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Integrate Simple Plugin Page into Current Theme WordPress

  • SOLVED

I have a plugin (WPMUDEV Directory plugin) http://premium.wpmudev.org/project/wordpress-directory/

the plugin creates the page "single-listing.php":

<?php get_header() ?>

<div id="content"><!-- start #content -->
<div class="padder">
<div class="page" id="blog-single"><!-- start #blog-single -->

<?php if ( have_posts() ) : ?>

<?php while ( have_posts() ) : the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="entry-meta">
<?php the_dr_posted_on(); ?>
<?php do_action('sr_avg_rating'); ?><br />
<span class="comments"><?php comments_popup_link( __( 'No Reviews &#187;', THEME_TEXT_DOMAIN ), __( '1 Review &#187;', THEME_TEXT_DOMAIN ), __( '% Reviews &#187;', THEME_TEXT_DOMAIN ), '', __( 'Reviews Off', THEME_TEXT_DOMAIN) ); ?></span>
<br />
<?php the_dr_posted_in(); ?>
<?php edit_post_link( __( 'Edit', THEME_TEXT_DOMAIN ), '<span class="edit-link">', '</span>' ); ?>
<span class="tags"><?php the_tags( __( 'Tags: ', THEME_TEXT_DOMAIN ), ', ', ''); ?></span>

<?php if ( !is_user_logged_in() ) : ?>
<?php echo '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to rate item.', THEME_TEXT_DOMAIN ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post->ID ) ) ) ) . '</p>'; ?>
<?php else: ?>
<?php do_action('sr_rate_this'); ?>
<?php endif; ?>
</div>

<div class="entry-post">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php if( has_post_thumbnail() ): ?>
<?php the_post_thumbnail( array( 275, 100 ), array( 'class' => 'alignleft' ) ); ?>
<?php endif; ?>
<?php the_content(); ?>
<div class="dr-custom-block">
<?php echo do_shortcode('[custom_fields_block wrap="table"][/custom_fields_block]'); ?>
</div>

<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', THEME_TEXT_DOMAIN ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<div class="clear"></div>
</div>

<?php if ( get_the_author_meta( 'description' ) ) : // If a user has filled out their description, show a bio on their entries ?>
<div id="entry-author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), 60 ); ?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( esc_attr__( 'About %s', THEME_TEXT_DOMAIN ), get_the_author() ); ?></h2>
<?php the_author_meta( 'description' ); ?>
<div id="author-link">
<a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">
<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', THEME_TEXT_DOMAIN ), get_the_author() ); ?>
</a>
</div><!-- #author-link -->
</div><!-- #author-description -->
</div><!-- #entry-author-info -->
<?php endif; ?>

</div>

<div id="commentbox">
<?php comments_template('', true); ?>
</div>

<?php endwhile; ?>

<div id="post-navigator">
<div class="alignleft"><?php next_posts_link( __( '&laquo; Previous Entries', THEME_TEXT_DOMAIN ) ) ?></div>
<div class="alignright"><?php previous_posts_link( __( 'Next Entries &raquo;', THEME_TEXT_DOMAIN ) ) ?></div>
</div>

<?php else : ?>

<h3><?php _e("Sorry, we can't find the post you're looking for at this URL. Please try selecting a menu item from above or to the side of this message to get where you'd like to go.", THEME_TEXT_DOMAIN); ?></h3>

<?php endif; ?>

</div><!-- end #blog-single -->
</div>
</div><!-- end #content -->

<?php get_footer() ?>




I also have a theme: King Power. I want the plugin's single-listing.php page to work like the theme pages (single.php pages).

Please integrate the plugin page with this theme page:

<?php get_header(); ?>
<?php
// Check and get Sidebar Class
$sidebar = get_post_meta($post->ID,'post-option-sidebar-template',true);
if( empty($sidebar) ){
global $default_post_sidebar;
$sidebar = $default_post_sidebar;
}
$sidebar_array = gdl_get_sidebar_size( $sidebar );

// Translator words
if( $gdl_admin_translator == 'enable' ){
$translator_about_author = get_option(THEME_SHORT_NAME.'_translator_about_author', 'About the Author');
$translator_social_share = get_option(THEME_SHORT_NAME.'_translator_social_shares', 'Social Share');
}else{
$translator_about_author = __('About the Author','gdl_front_end');
$translator_social_share = __('Social Share','gdl_front_end');
}
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="page-wrapper single-blog <?php echo $sidebar_array['sidebar_class']; ?>">
<?php
global $left_sidebar, $right_sidebar, $default_post_left_sidebar, $default_post_right_sidebar;
$left_sidebar = get_post_meta( $post->ID , "post-option-choose-left-sidebar", true);
$right_sidebar = get_post_meta( $post->ID , "post-option-choose-right-sidebar", true);
if( empty( $left_sidebar )){ $left_sidebar = $default_post_left_sidebar; }
if( empty( $right_sidebar )){ $right_sidebar = $default_post_right_sidebar; }

global $blog_single_size, $sidebar_type;
$item_size = $blog_single_size[$sidebar_type];

// starting the content
echo '<div class="row gdl-page-row-wrapper">';
echo '<div class="gdl-page-left mb0 ' . $sidebar_array['page_left_class'] . '">';

echo '<div class="row">';
echo '<div class="gdl-page-item mb0 pb20 gdl-blog-full ' . $sidebar_array['page_item_class'] . '">';
if ( have_posts() ){
while (have_posts()){
the_post();

// blog thumbnail
print_single_blog_thumbnail( get_the_ID(), $item_size );

echo '<div class="blog-content-wrapper">';

echo '<div class="blog-comment"><i class="icon-comments"></i>';
comments_popup_link( __('0 Comment','gdl_front_end'),
__('1 Comment','gdl_front_end'),
__('% Comments','gdl_front_end'), '',
__('Comment are off','gdl_front_end') );
echo '</div>';

// blog title
echo '<h1 class="blog-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1>';

// blog information
echo '<div class="blog-info-wrapper">';
echo '<div class="blog-date"><i class="icon-calendar"></i>';
echo '<a href="' . get_day_link( get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '" >';
echo get_the_time($gdl_date_format);
echo '</a>';
echo '</div>';

echo '<div class="blog-author"><i class="icon-user"></i>';
echo the_author_posts_link();
echo '</div>';

$tags_opening = '<div class="blog-tag"><i class="icon-tags"></i>';
$tags_ending = '</div>';
the_tags( $tags_opening, ', ', $tags_ending );

echo '<div class="clear"></div>';
echo '</div>'; // blog information

// blog content
echo '<div class="blog-content">';
the_content();
wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'gdl_front_end' ) . '</span>', 'after' => '</div>' ) );
echo '<div class="clear"></div>';
echo '</div>';

// About Author
if(get_post_meta($post->ID, 'post-option-author-info-enabled', true) != "No"){
echo "<div class='about-author-wrapper'>";
echo "<div class='about-author-avartar'>" . get_avatar( get_the_author_meta('ID'), 90 ) . "</div>";
echo "<div class='about-author-info'>";
echo "<h5 class='about-author-title'>" . $translator_about_author . "</h5>";
echo get_the_author_meta('description');
echo "</div>";
echo "<div class='clear'></div>";
echo "</div>";
}

// Include Social Shares
if(get_post_meta($post->ID, 'post-option-social-enabled', true) != "No"){
echo "<h3 class='social-share-title'>" . $translator_social_share . '</h3>';
include_social_shares();
echo "<div class='clear'></div>";
}

echo '<div class="comment-wrapper">';
comments_template();
echo '</div>';

echo '</div>'; // blog content wrapper
}
}
echo "</div>"; // end of gdl-page-item

get_sidebar('left');
echo '<div class="clear"></div>';
echo "</div>"; // row
echo "</div>"; // gdl-page-left

get_sidebar('right');
echo '<div class="clear"></div>';
echo "</div>"; // row
?>
<div class="clear"></div>
</div> <!-- page wrapper -->
</div> <!-- post class -->

<?php get_footer(); ?>

Answers (1)

2013-05-20

Arnav Joy answers:

try this

<?php get_header(); ?>

<?php

// Check and get Sidebar Class

$sidebar = get_post_meta($post->ID,'post-option-sidebar-template',true);

if( empty($sidebar) ){

global $default_post_sidebar;

$sidebar = $default_post_sidebar;

}

$sidebar_array = gdl_get_sidebar_size( $sidebar );



// Translator words

if( $gdl_admin_translator == 'enable' ){

$translator_about_author = get_option(THEME_SHORT_NAME.'_translator_about_author', 'About the Author');

$translator_social_share = get_option(THEME_SHORT_NAME.'_translator_social_shares', 'Social Share');

}else{

$translator_about_author = __('About the Author','gdl_front_end');

$translator_social_share = __('Social Share','gdl_front_end');

}

?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="page-wrapper single-blog <?php echo $sidebar_array['sidebar_class']; ?>">

<?php

global $left_sidebar, $right_sidebar, $default_post_left_sidebar, $default_post_right_sidebar;

$left_sidebar = get_post_meta( $post->ID , "post-option-choose-left-sidebar", true);

$right_sidebar = get_post_meta( $post->ID , "post-option-choose-right-sidebar", true);

if( empty( $left_sidebar )){ $left_sidebar = $default_post_left_sidebar; }

if( empty( $right_sidebar )){ $right_sidebar = $default_post_right_sidebar; }



global $blog_single_size, $sidebar_type;

$item_size = $blog_single_size[$sidebar_type];



// starting the content

echo '<div class="row gdl-page-row-wrapper">';

echo '<div class="gdl-page-left mb0 ' . $sidebar_array['page_left_class'] . '">';



echo '<div class="row">';

echo '<div class="gdl-page-item mb0 pb20 gdl-blog-full ' . $sidebar_array['page_item_class'] . '">';

if ( have_posts() ){

while (have_posts()){

the_post();



// blog thumbnail

print_single_blog_thumbnail( get_the_ID(), $item_size );



echo '<div class="blog-content-wrapper">';



echo '<div class="blog-comment"><i class="icon-comments"></i>';

comments_popup_link( __('0 Comment','gdl_front_end'),

__('1 Comment','gdl_front_end'),

__('% Comments','gdl_front_end'), '',

__('Comment are off','gdl_front_end') );

echo '</div>';



// blog title

echo '<h1 class="blog-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1>';



// blog information

echo '<div class="blog-info-wrapper">';

?>

<div class="entry-meta">

<?php the_dr_posted_on(); ?>

<?php do_action('sr_avg_rating'); ?><br />

<span class="comments"><?php comments_popup_link( __( 'No Reviews &#187;', THEME_TEXT_DOMAIN ), __( '1 Review &#187;', THEME_TEXT_DOMAIN ), __( '% Reviews &#187;', THEME_TEXT_DOMAIN ), '', __( 'Reviews Off', THEME_TEXT_DOMAIN) ); ?></span>

<br />

<?php the_dr_posted_in(); ?>

<?php edit_post_link( __( 'Edit', THEME_TEXT_DOMAIN ), '<span class="edit-link">', '</span>' ); ?>

<span class="tags"><?php the_tags( __( 'Tags: ', THEME_TEXT_DOMAIN ), ', ', ''); ?></span>



<?php if ( !is_user_logged_in() ) : ?>

<?php echo '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to rate item.', THEME_TEXT_DOMAIN ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post->ID ) ) ) ) . '</p>'; ?>

<?php else: ?>

<?php do_action('sr_rate_this'); ?>

<?php endif; ?>

</div>
<?php
echo '<div class="blog-date"><i class="icon-calendar"></i>';

echo '<a href="' . get_day_link( get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '" >';

echo get_the_time($gdl_date_format);

echo '</a>';

echo '</div>';



echo '<div class="blog-author"><i class="icon-user"></i>';

echo the_author_posts_link();

echo '</div>';



$tags_opening = '<div class="blog-tag"><i class="icon-tags"></i>';

$tags_ending = '</div>';

the_tags( $tags_opening, ', ', $tags_ending );



echo '<div class="clear"></div>';

echo '</div>'; // blog information



// blog content

echo '<div class="blog-content">';

the_content();

?>

<div class="dr-custom-block">

<?php echo do_shortcode('[custom_fields_block wrap="table"][/custom_fields_block]'); ?>

</div>

<?php

wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'gdl_front_end' ) . '</span>', 'after' => '</div>' ) );

echo '<div class="clear"></div>';

echo '</div>';



// About Author

if(get_post_meta($post->ID, 'post-option-author-info-enabled', true) != "No"){

echo "<div class='about-author-wrapper'>";

echo "<div class='about-author-avartar'>" . get_avatar( get_the_author_meta('ID'), 90 ) . "</div>";

echo "<div class='about-author-info'>";

echo "<h5 class='about-author-title'>" . $translator_about_author . "</h5>";

echo get_the_author_meta('description');

echo "</div>";

echo "<div class='clear'></div>";

echo "</div>";

}



// Include Social Shares

if(get_post_meta($post->ID, 'post-option-social-enabled', true) != "No"){

echo "<h3 class='social-share-title'>" . $translator_social_share . '</h3>';

include_social_shares();

echo "<div class='clear'></div>";

}



echo '<div class="comment-wrapper">';

comments_template();

echo '</div>';



echo '</div>'; // blog content wrapper

}

}

echo "</div>"; // end of gdl-page-item



get_sidebar('left');

echo '<div class="clear"></div>';

echo "</div>"; // row

echo "</div>"; // gdl-page-left



get_sidebar('right');

echo '<div class="clear"></div>';

echo "</div>"; // row

?>

<div class="clear"></div>

</div> <!-- page wrapper -->

</div> <!-- post class -->



<?php get_footer(); ?>


yellowhuman comments:

Hi thanks for answering my question here: http://www.wpquestions.com/question/showChronoLoggedIn/id/8428
I have 3 more files that are similar and need to be integrated
Wondering if you would mind helping me
Here is the first one: archive-listings.php
<?php get_header(); ?>

<div id="content"><!-- start #content -->
<div class="padder">
<div class="page" id="blog-archives"><!-- start #blog-archives -->
<?php locate_template( array( '/components/headers.php' ), true ); ?>

<?php if ( have_posts() ) : ?>
<?php locate_template( array( '/loops/loop-excerpt.php' ), true ); ?>
<?php locate_template( array( '/components/pagination.php' ), true ); ?>
<?php else: ?>
<?php locate_template( array( '/components/messages.php' ), true ); ?>
<?php endif; ?>

</div><!-- end #blog-archives -->
</div>
</div><!-- end #content -->

<?php get_footer(); ?>



Here is the second one: drlistingslist.php
<?php
/**
* The template for displaying Taxonomy pages.
*/
?>

<?php get_header() ?>

<div id="content"><!-- start #content -->
<div class="padder">
<div class="breadcrumbtrail">
<h1 class="page-title dp-taxonomy-name">
<?php the_dr_breadcrumbs(); ?>
</h1>
<div class="clear"></div>
</div>

<?php the_dr_categories_archive(); ?>
<div class="clear"></div><br />

<?php if ( have_posts() ) : ?>

<?php while ( have_posts() ) : the_post(); ?>

<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<div class="entry-meta">
<?php the_dr_posted_on(); ?>

<div class="entry-utility">
<?php
// Retrieves categories list of current post, separated by commas.
$categories = wp_get_post_terms( $post->ID, "listing_category", "" );

foreach ( $categories as $category )
$categories_list[] = '<a href="' . get_term_link( $category ) . '" title="' . $category->name . '" >' . $category->name . '</a>';

$categories_list = implode( ", ", ( array ) $categories_list );

?>

<?php if ( $categories_list ) : ?>
<span class="cat-links">
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', THEME_TEXT_DOMAIN ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list ); ?>
</span>
<br />
<?php unset( $categories_list ) ?>
<?php endif; ?>

<?php
// Retrieves tag list of current post, separated by commas.
$tags = wp_get_post_terms( $post->ID, "listing_tag", "" );
foreach ( $tags as $tag )
$tags_list[] = '<a href="' . get_term_link( $tag ) . '" title="' . $tag->name . '" >' . $tag->name . '</a>';

$tags_list = implode( ", ", ( array ) $tags_list );
?>

<?php if ( $tags_list ): ?>
<span class="tag-links">
<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', THEME_TEXT_DOMAIN ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
</span>
<br />
<?php unset( $tags_list ) ?>
<?php endif; ?>

<?php do_action('sr_avg_ratings_of_listings', get_the_ID() ); ?>

<span class="comments-link"><?php comments_popup_link( __( 'Leave a review', THEME_TEXT_DOMAIN ), __( '1 Review', THEME_TEXT_DOMAIN ), __( '% Reviews', THEME_TEXT_DOMAIN ), '', __( 'Reviews Off', THEME_TEXT_DOMAIN ) ); ?></span>;
<?php edit_post_link( __( 'Edit', THEME_TEXT_DOMAIN ), '<span class="edit-link">', '</span>' ); ?>

</div><!-- .entry-utility -->
</div><!-- .entry-meta -->

<div class="entry-post">
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', THEME_TEXT_DOMAIN ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h2>

<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
<div class="entry-summary">
<?php if( has_post_thumbnail() ): ?>
<?php the_post_thumbnail( array( 50, 50 ), array( 'class' => 'alignleft' )); ?>
<?php endif; ?>
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', THEME_TEXT_DOMAIN ) ); ?>
<?php //wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', THEME_TEXT_DOMAIN ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>

<div class="clear"></div>
</div>

</div><!-- #post-## -->

<?php //comments_template( '', true ); ?>

<?php endwhile; ?>

<div id="post-navigator-single">
<div class="alignleft"><?php previous_post_link('&laquo;%link') ?></div>
<div class="alignright"><?php next_post_link('%link&raquo;') ?></div>
</div>

<?php else : ?>

<h3><?php _e("Sorry, we can't find the archive you're looking for at this URL. Please try selecting a menu item from above or to the side of this message to get where you'd like to go.", THEME_TEXT_DOMAIN); ?></h3>

<?php endif; ?>

</div>
</div><!-- end #content -->

<?php get_footer() ?>



The last one is homelisting.php

<?php get_header() ?>

<div id="content"><!-- start #content -->
<div class="padder">
<?php echo do_shortcode( '[dr_list_categories style="grid"]' ); ?>
</div>
</div><!-- end #content -->

<?php get_footer() ?>



this is what the archive.php file looks like for my theme:
<?php get_header(); ?>
<?php
// Check and get Sidebar Class
$sidebar = get_option(THEME_SHORT_NAME.'_search_archive_sidebar','no-sidebar');
$sidebar_array = gdl_get_sidebar_size( $sidebar );
?>
<div class="page-wrapper archive-page <?php echo $sidebar_array['sidebar_class']; ?>">
<?php
$left_sidebar = get_option(THEME_SHORT_NAME.'_search_archive_left_sidebar');
$right_sidebar = get_option(THEME_SHORT_NAME.'_search_archive_right_sidebar');

echo '<div class="row gdl-page-row-wrapper">';
echo '<div class="gdl-page-left mb0 ' . $sidebar_array['page_left_class'] . '">';

echo '<div class="row">';
echo '<div class="gdl-page-item mb0 pb20 ' . $sidebar_array['page_item_class'] . '">';

if( !is_tax('portfolio-category') && !is_tax('portfolio-tag') ){

// blog archive
$item_type = get_option(THEME_SHORT_NAME.'_search_archive_item_size', '1/1 Full Thumbnail');
$num_excerpt = get_option(THEME_SHORT_NAME.'_search_archive_num_excerpt', 285);
$full_content = get_option(THEME_SHORT_NAME.'_search_archive_full_blog_content', 'No');

global $blog_div_size_num_class;
$item_class = $blog_div_size_num_class[$item_type]['class'];
$item_size = $blog_div_size_num_class[$item_type][$sidebar_type];


echo '<div id="blog-item-holder" class="blog-item-holder">';
if( $item_type == '1/4 Blog Widget' || $item_type == '1/3 Blog Widget' ||
$item_type == '1/2 Blog Widget' || $item_type == '1/1 Blog Widget'){
print_blog_widget($item_class, $item_size, $num_excerpt, $full_content, $item_type);
}else if( $item_type == '1/1 Medium Thumbnail' ){
print_blog_medium($item_class, $item_size, $num_excerpt, $full_content);
}else if( $item_type == '1/1 Full Thumbnail' ){
print_blog_full($item_class, $item_size, $num_excerpt, $full_content);
}
echo '</div>'; // blog-item-holder
}else{

// portfolio archive
$port_size = get_option(THEME_SHORT_NAME.'_portfolio_archive_size' ,'1/4');
$show_title = (get_option(THEME_SHORT_NAME.'_portfolio_archive_show_title' ,'Yes') == "Yes")? true: false;
$show_tag = (get_option(THEME_SHORT_NAME.'_portfolio_archive_show_tags' ,'Yes') == "Yes")? true: false;
print_normal_portfolio($port_size, $show_title, $show_tag);
}

echo '<div class="clear"></div>';
pagination();

echo "</div>"; // end of gdl-page-item

get_sidebar('left');
echo '<div class="clear"></div>';
echo "</div>"; // row
echo "</div>"; // gdl-page-left

get_sidebar('right');
echo '<div class="clear"></div>';
echo "</div>"; // row
?>
<div class="clear"></div>
</div> <!-- page wrapper -->
<?php get_footer(); ?>



Thanks in advanced for the help. not sure how to make sure you get the money on that answer

If this task requires money, please let me know how much.


Arnav Joy comments:

I have little confusion

you have listed four files here

1. archive-listings.php
2. drlistingslist.php
3. homelisting.php
4. archive.php


so first three are from the plugin or from your theme ?

what you want , do you want to change first three files as per your theme ?


yellowhuman comments:

Yes please.

I added you on skype. Maybe i could give you admin access.