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

Feature/#770 posted on tweaks #774

Merged
merged 8 commits into from
Dec 30, 2021
Merged

Conversation

batesweb
Copy link
Contributor

@batesweb batesweb commented Oct 19, 2021

Closes #770

DESCRIPTION

Refactors the _s_posted_on() function to make the code more readable and configurable. This function has been replaced by two new functions: _s_post_date() and _s_post_author().

OTHER

  • Is this issue accessible? (Section 508/WCAG 2.0AA)
  • Does this issue pass all the linting? (PHPCS, ESLint, SassLint)
  • Does this pass CBT?

STEPS TO VERIFY

View singles/archives to make sure post dates and authors are being rendered correctly.

DOCUMENTATION

Will this pull request require updating the wd_s wiki?

Copy link
Contributor

@oliverharrison oliverharrison left a comment

Choose a reason for hiding this comment

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

This looks good to me. A nice improvement and much more readable than the previous function.

@coreymcollins
Copy link
Contributor

@batesweb – this will require some updates to the wiki (https://github.com/WebDevStudios/wd_s/wiki/Template-Tags#post-meta-information). Could you prep that for when this is ready to merge in? Thanks!

@coreymcollins coreymcollins added the documentation An update to documentation is required after a PR has been approved and merged in. label Nov 24, 2021
@batesweb
Copy link
Contributor Author

batesweb commented Dec 30, 2021

Here's the updated documentation. This will replace the "Post Meta Information" section:

Post Date

_s_post_date

Prints HTML with the post date for the current post.

Usage: <?php _s_post_date(); ?>

Output:

<time class="entry-date published" datetime="2021-10-12T16:27:10+00:00">October 12, 2021</time>

Location: /inc/template-tags.php

Post Author

_s_post_author

Prints HTML with the post author for the current post.

Usage: <?php _s_post_author(); ?>

Output:

<span class="post-author">
     by <span class="author vcard">
	<a class="url fn n" href="http://wds-dev.local/author/admin/">admin</a>
     </span>
</span>

Location: /inc/template-tags.php

@coreymcollins
Copy link
Contributor

This is looking really great! I've tested the split functions and passed in my own strings to make sure those work.

One thing I've noticed is that while we have a content-search.php file, this is never used because there's no search.php file in the top-level theme. The changes made to content-search.php are never seen currently because the search results page uses content.php.

Would you be able to add a top-level search.php file and make any necessary tweaks to content-search.php to make sure search results are displayed nicely, and that the date/author functions are working as expected?

Thanks!

@batesweb
Copy link
Contributor Author

I can definitely set that up, @coreymcollins , but should that be a part of this PR? @oliverharrison and I had talked about adding in some of those "missing" files (search.php, page.php, etc.), but it seems like that should be its own PR.

@coreymcollins
Copy link
Contributor

I feel like it's a small enough addition that it could be added here, especially if we're trying to leverage the new functions in the content-search.php file. Without a search.php file (or a conditional elsewhere) calling for that content-search.php file, it could be confusing to a new user as to why their changes aren't showing up if they edit the template part.

@batesweb
Copy link
Contributor Author

@coreymcollins is that what you had in mind?

@coreymcollins
Copy link
Contributor

This is great – thanks! I'll merge this in and add your updates to the docs.

@coreymcollins coreymcollins merged commit 67ec765 into main Dec 30, 2021
@coreymcollins coreymcollins deleted the feature/#770-posted-on-tweaks branch December 30, 2021 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An update to documentation is required after a PR has been approved and merged in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "posted_on" function is obtuse and not functional unless rewritten
3 participants