-1

currently my theme on WordPress is Neve , and my posts all over the blog shows the following meta info : https://i.stack.imgur.com/ynu71.jpg

where : 1- post title 2- post author 3- post date 4- post category

i want to replace these post meta with similar to this: https://i.stack.imgur.com/Xywa9.jpg

for this purpose i have created a child theme and then installed snippet plugin to add php code easily and deactivate it once it is not working . unfortunately i could not find the code that can do the required modifications on that post meta : https://i.stack.imgur.com/uwCrS.jpg

can any one provide a full php code to modify all these changes in one time after pasting into snippet ? or if there is another way i can do it ?

Waleed
  • 1
  • 1

1 Answers1

0

You'll have to create a child theme (already done) where you can override the current blog post template, instead of using a snippet plugin. To do this, copy the blog post template file from your theme and add it to your child theme. WordPress will now read your child theme template instead of your theme's template, and you can easily modify the DOM from there, and shape the layout/text however way you want. (You can use the theme editor built-in in WordPress to modify the new child theme file. No plugin required.)

This is the proper way to modify a post page without plugins, and you can easily grab thing such as a post date, author, etc. via WordPress' built-in function. Example of how to get the author name of a WordPress post in PHP.

As for, 'latest edition' date, I will lend you a snippet I wrote for a client as WordPress. This will return the date at which a post has been modified as long as it is different from the publishing date (tweaks are common right after publication so it's a tad pointless to show a "last edited date" as the same as the publication date).

function current_post_last_edited_date_formatted() {
  if(get_the_modified_date() !== get_the_date()) {
    return '<p class="last-edited"> Last edited <span class="data">'.current_post_last_edited_date().'</span></p>';
  } else {
      return '';
  };
}

The function you see called in the condition are WordPress core functions. =)

Nazrinn
  • 1
  • 1
  • 1