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

Updated the Dashboard Widget Output #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions classes/class-linker-cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,22 @@ public function linker_dashboard_widget_function() {
</thead>
<tbody>
<?php
// Count the posts
$max_links = count($posts);
$i = 1;
//loop over each post
foreach ( $posts as $post_id ) :
// Get the meta you need from each post
$link = get_post_meta( $post_id, '_linker_redirect', true );
$link_count = absint( get_post_meta( $post_id, '_linker_count', true ) );
$i++;
?>
<tr>
<td><a target="_blank" href="<?php echo $link; ?>"><?php echo $link; ?></a></td>
<td><a href="<?php echo get_edit_post_link( $post_id ); ?>"><?php _e( 'Edit', 'linker' ); ?></a></td>
<td><?php echo $link_count; ?></td>
<td <?php echo ($i <= $max_links ? 'class="border-bottom"':'class="no-border-bottom"');?>>
<strong><?php echo get_the_title( $post_id ); ?></strong><br />
<a target="_blank" href="<?php echo $link; ?>"><?php echo $link; ?></a></td>
<td <?php echo ($i <= $max_links ? 'class="border-bottom"':'class="no-border-bottom"');?>><a href="<?php echo get_edit_post_link( $post_id ); ?>"><?php _e( 'Edit', 'linker' ); ?></a></td>
<td <?php echo ($i <= $max_links ? 'class="border-bottom"':'class="no-border-bottom"');?>><?php echo $link_count; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand Down