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

Add WordPress versions list page #267

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

audrasjb
Copy link

@audrasjb audrasjb commented Sep 29, 2018

Hi,
Here is a workaround for the WordPress versions archive page (issue #246).
Of course it will needs some styling.

I don't know where to properly add my CSS rules so here are the CSS I added on my side:

.helphub_versions_table {
	border: 1px solid #ccc;
	border-collapse: collapse;
}
.helphub_versions_table th, .helphub_versions_table td {
	padding: 0.5em;
	vertical-align: middle;
	border: 1px solid #ccc;
}
.helphub_versions_table th {
	background: #dedede;
	font-weight: bold;
}
.helphub_versions_major td {
	background: #dedede;
}
.helphub_versions_table a {
	text-decoration: underline;
}

And here is a screenshot (with fake data) of the result:
capture d ecran 2018-09-29 a 10 23 03

If you see some possible enhancement, feel free to get in touch! 😃
Cheers,
Jb

<td><?php if ( get_post_meta( get_the_ID(), '_version_date', true ) ) { echo date_i18n( get_option( 'date_format' ), get_post_meta( get_the_ID(), '_version_date', true ) ); } ?>
</td>
<td><?php echo $major_version; ?></td>
<td><?php if ( get_post_meta( get_the_ID(), '_musician_codename', true ) ) { echo get_post_meta( get_the_ID(), '_musician_codename', true ); } ?>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace:

if ( get_post_meta( get_the_ID(), '_musician_codename', true ) ) {
    echo get_post_meta( get_the_ID(), '_musician_codename', true );
}

With a variable:

$musician = get_post_meta( get_the_ID(), '_musician_codename', true );
if ( $musician ) echo $musician;

Or even better, echo the result with short if:

$musician = get_post_meta( get_the_ID(), '_musician_codename', true );
echo $musician ? $musician : '';

You can apply this to other post-meta values.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants