Filtering articles and adding the date to the title tag

Some more useful code snippets for site readers.

Adding the date to the title tag of your articles on the site.

Sometimes, in order to show the age of an article for search engines, they use the date in the title tag.. The date in this tag is metadata for search engines.. I don't do it myself, but I think, SEO specialists can evaluate this code. In my opinion, this may be useful for news resources.

 

Another just bomb code, honestly found in bynet )

I think a lot of people have this problem, when the site starts to grow and there are a lot of custom fields on it, in which it is difficult to find the necessary information. For example, it can be an online store with fields containing the type of product by which all these products should be filtered.. I recently found a solution to this problem, how to make a drop down list to filter by all custom fields. The list will appear at the top above the list of articles in the admin panel.

To solve this filtering task of this type, add the code to the file function.php and happy with the result. Code below:

You can see the script in action in the screenshot.:

Фильтр по произвольным полям

Code works great, checked everything on the test site.


Buy WordPress hosting
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

8 Responses

  1. Evgeny Gorchak says:

    Thanks for the great addition.. Protestil code, generally works, sorts by all custom fields, except one, which is exactly what I needed.

    All my records have a custom field instock with the value 1 or 0. Sort with value 1 works fine, but when trying to sort the records with the value 0 does not work, the filter just stupidly displays all posts of the category, and with meaning 0 and 1.

    It looks like the code does not want to accept the value 0 custom field instock. How to teach it to sort by value as well 0?

    I have an old version, 2.7.1, update is not yet possible due to incompatibility with a complex online store plugin.

    Thanks.

  2. Evgeny Gorchak says:

    It really pleases. And that, just checked, filter works with value 00, only 0 does not perceive.
    Thanks again.

    • admin says:

      Just added on the test site 3 records with a new custom field. For two made a difference 0, but for one 1. As a result, it turned out to filter out only by zero value, as a result received 2 records and by value “1” got one too. Maybe you're doing something wrong, Or maybe I didn't understand the question.?

      • Evgeny Gorchak says:

        Apparently there is something wrong with my wordpress installation., the question is understood correctly, I still can't sort by value 0.
        I think to do something.

        • admin says:

          Try to make another custom field with the same parameters, to contain 0 and 1, and try to filter by it. If it does not work out, maybe it's a problem with wordpress. You can try to update the CMS on the test site, the main thing is that a copy of the database and files be )

  3. Evgeny Gorchak says:

    Thanks for the good idea, tried to set the value 0 another field and sort by 0 works fine. So the problem is not the meaning 0 and not in WordPress, but in this particular instock field, it is in this field that it is impossible to sort by value 0.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal