• I have edited the dashboard template file to show only featured image and the title below it, now I need to show 3 titles in a row instead of one title in a row. below is the edited code `<?php

    /**
    * Dashboard class
    *
    * @author Tareq Hasan
    * @package WP User Frontend
    */
    class WPUF_Dashboard {

    function __construct() {
    add_shortcode( ‘wpuf_dashboard’, array($this, ‘shortcode’) );
    }

    /**
    * Handle’s user dashboard functionality
    *
    * Insert shortcode [wpuf_dashboard] in a page to
    * show the user dashboard
    *
    * @since 0.1
    */
    function shortcode( $atts ) {

    $post_type = wpuf_get_option( ‘post_type’, ‘wpuf_dashboard’, ‘post’ );
    $default = array(‘post_type’ => $post_type);

    extract( shortcode_atts( $default, $atts ) );

    ob_start();

    if ( is_user_logged_in() ) {
    $this->post_listing( $post_type );
    } else {
    printf( __( “This page is restricted. Please %s to view this page.”, ‘wpuf’ ), wp_loginout( ”, false ) );
    }

    $content = ob_get_contents();
    ob_end_clean();

    return $content;
    }

    /**
    * List’s all the posts by the user
    *
    * @global object $wpdb
    * @global object $userdata
    */
    function post_listing( $post_type ) {
    global $wpdb, $userdata, $post;

    $userdata = get_userdata( $userdata->ID );
    $pagenum = isset( $_GET[‘pagenum’] ) ? intval( $_GET[‘pagenum’] ) : 1;

    $args = array(
    ‘author’ => get_current_user_id(),
    ‘post_status’ => array(‘draft’, ‘future’, ‘pending’, ‘publish’),
    ‘post_type’ => $post_type,
    ‘posts_per_page’ => wpuf_get_option( ‘per_page’, ‘wpuf_dashboard’, 10 ),
    ‘paged’ => $pagenum
    );

    $dashboard_query = new WP_Query( $args );
    $post_type_obj = get_post_type_object( $post_type );
    ?>

    <h2 class=”page-head”>
    <span class=”colour”><?php printf( __( “%s’s Stories”, ‘wpuf’ ), $userdata->user_login ); ?></span>
    </h2>

    <?php if ( wpuf_get_option( ‘show_post_count’, ‘wpuf_dashboard’, ‘on’ ) == ‘on’ ) { ?>
    <div class=”post_count”><?php printf( __( ‘You have created <span>%d</span> %s’, ‘wpuf’ ), $dashboard_query->found_posts, $post_type_obj->label ); ?></div>
    <?php } ?>

    <?php do_action( ‘wpuf_dashboard_top’, $userdata->ID, $post_type_obj ) ?>

    <?php if ( $dashboard_query->have_posts() ) { ?>

    <?php
    $featured_img = wpuf_get_option( ‘show_ft_image’, ‘wpuf_dashboard’ );
    $featured_img_size = wpuf_get_option( ‘ft_img_size’, ‘wpuf_dashboard’ );
    $charging_enabled = wpuf_get_option( ‘charge_posting’, ‘wpuf_payment’, ‘no’ );
    ?>
    <table class=”wpuf-table” cellpadding=”0″ cellspacing=”0″>
    <thead>

    </thead>
    <tbody>
    <?php
    while ($dashboard_query->have_posts()) {
    $dashboard_query->the_post();
    ?>
    <tr>
    <?php if ( ‘on’ == $featured_img ) { ?>
    <td>
    <?php
    if ( has_post_thumbnail() ) {
    the_post_thumbnail( $featured_img_size );
    } else {
    printf( ‘<img src=”%1$s” class=”attachment-thumbnail wp-post-image” alt=”%2$s” title=”%2$s” />’, apply_filters( ‘wpuf_no_image’, plugins_url( ‘/images/no-image.png’, __FILE__ ) ), __( ‘No Image’, ‘wpuf’ ) );
    }
    ?>
    <?php if ( in_array( $post->post_status, array(‘draft’, ‘future’, ‘pending’) ) ) { ?>

    <?php the_title(); ?>

    <?php } else { ?>

    <center> <a href=”<?php the_permalink(); ?>” title=”<?php printf( esc_attr__( ‘Permalink to %s’, ‘wpuf’ ), the_title_attribute( ‘echo=0’ ) ); ?>” rel=”bookmark”><?php the_title(); ?></a>
    </center>
    <?php } ?>
    </td>

    <?php } ?>

    <?php
    if ( $charging_enabled == ‘yes’ ) {
    $order_id = get_post_meta( $post->ID, ‘wpuf_order_id’, true );
    ?>

    <?php } ?>

    </tr>
    <?php } ?>
    </tbody>
    </table>

    <div class=”wpuf-pagination”>
    <?php
    $pagination = paginate_links( array(
    ‘base’ => add_query_arg( ‘pagenum’, ‘%#%’ ),
    ‘format’ => ”,
    ‘prev_text’ => __( ‘«’, ‘wpuf’ ),
    ‘next_text’ => __( ‘»’, ‘wpuf’ ),
    ‘total’ => $dashboard_query->max_num_pages,
    ‘current’ => $pagenum
    ) );

    if ( $pagination ) {
    echo $pagination;
    }
    ?>
    </div>

    <?php
    } else {
    printf( __( ‘No %s found’, ‘wpuf’ ), $post_type_obj->label );
    do_action( ‘wpuf_dashboard_nopost’, $userdata->ID, $post_type_obj );
    }

    do_action( ‘wpuf_dashboard_bottom’, $userdata->ID, $post_type_obj );
    ?>

    <?php
    $this->user_info();

    // clean $dashboard_query from corrupting beyond use
    wp_reset_query();
    }

    /**
    * Show user info on dashboard
    */
    function user_info() {
    global $userdata;

    if ( wpuf_get_option( ‘show_user_bio’, ‘wpuf_dashboard’, ‘on’ ) == ‘on’ ) {
    ?>
    <div class=”wpuf-author”>
    <h3><?php _e( ‘Author Info’, ‘wpuf’ ); ?></h3>
    <div class=”wpuf-author-inside odd”>
    <div class=”wpuf-user-image”><?php echo get_avatar( $userdata->user_email, 80 ); ?></div>
    <div class=”wpuf-author-body”>
    <p class=”wpuf-user-name”><a href=”<?php echo get_author_posts_url( $userdata->ID ); ?>”><?php printf( esc_attr__( ‘%s’, ‘wpuf’ ), $userdata->display_name ); ?></a></p>
    <p class=”wpuf-author-info”><?php echo $userdata->description; ?></p>
    </div>
    </div>
    </div><!– .author –>
    <?php
    }
    }

    /**
    * Delete a post
    *
    * Only post author and editors has the capability to delete a post
    */
    function delete_post() {
    global $userdata;

    $nonce = $_REQUEST[‘_wpnonce’];
    if ( !wp_verify_nonce( $nonce, ‘wpuf_del’ ) ) {
    die( “Security check” );
    }

    //check, if the requested user is the post author
    $maybe_delete = get_post( $_REQUEST[‘pid’] );

    if ( ($maybe_delete->post_author == $userdata->ID) || current_user_can( ‘delete_others_pages’ ) ) {
    wp_delete_post( $_REQUEST[‘pid’] );

    //redirect
    $redirect = add_query_arg( array(‘msg’ => ‘deleted’), get_permalink() );
    wp_redirect( $redirect );
    } else {
    echo ‘<div class=”error”>’ . __( ‘You are not the post author. Cheeting huh!’, ‘wpuf’ ) . ‘</div>’;
    }
    }

    }

    $wpuf_dashboard = new WPUF_Dashboard();`

    https://www.ads-software.com/plugins/wp-user-frontend/

Viewing 1 replies (of 1 total)
  • Plugin Author weDevs

    (@wedevs)

    Hello,

    It is a general rules to single post in single row. But you have asked for a different scenario. What I can say you to please play around the code and you will get a clue hopefully.

    Thank you.

Viewing 1 replies (of 1 total)
  • The topic ‘I want to view User's Dashboard in 3 column instead of 1’ is closed to new replies.