Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
shubhra
tagDiv Member

I think this might be possible using a select query. You will have to troubleshoot it yourself though.


function get_meta_values( $key = '', $type = 'post', $status = 'publish', $author = '' ) {
    global $wpdb;
    if( empty( $key ) )
        return;
    $r = $wpdb->get_col( $wpdb->prepare( "
        SELECT pm.meta_value FROM {$wpdb->postmeta} pm
        LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id
        WHERE pm.meta_key = '%s' 
        AND p.post_status = '%s' 
        AND p.post_type = '%s'
        AND p.post_author = '%s'
    ", $key, $status, $type, $author ) );

    return $r;
}

Then in the author.php you do


$author_id = $part_cur_auth_obj->ID;
$total_views = get_meta_values( 'post_views_count', 'post', 'publish', $author_id );

This will return an array of data. You can manipulate this data howsoever you want.
For custom user profile fields, I think you can use Advanced Custom Fields plugin.

  • This reply was modified 11 years by shubhra.
shubhra
tagDiv Member

For blocks/modules you can get the ID like this – $this->post->ID; so you can do

<?php $id = $this->post->ID; ?>
<?php echo get_permalink($id); ?>

For single pages – $td_mod_single->post->ID;

shubhra
tagDiv Member

Hi, Thanks for replying. I actually read that and was very impressed, however, the practical example says Available on: Newsmag V1.8+, Newspaper V5+ at the top and we are using Newsmag 1.7.1 ?!

  • This reply was modified 11 years by shubhra.
shubhra
tagDiv Member

More articles box is using includes/modules/td_module_1.php. This file can’t be copied to the child theme, so you will have to edit the core.

shubhra
tagDiv Member

If you are using the default post template then you need to edit loop-single.php. Copy the file to the child theme and replace <?php echo $td_mod_single->get_date(false);?> with the code below.


<?php $postType = get_post_type( $td_mod_single->post->ID ); ?>
	<?php
		if ( 'YOUR_POST_TYPE_SLUG' == $postType ) {
		
		} else {
			echo $td_mod_single->get_date(false);
		}
	?>
  • This reply was modified 11 years by shubhra.
shubhra
tagDiv Member

+1. Don’t need buddypress, bbpress, woocommerce

shubhra
tagDiv Member

I appreciate your positive attitude and your willingness to make your themes more functional and flexible. Thank you for your efforts!

Viewing 7 posts - 26 through 32 (of 32 total)