Last active
December 17, 2015 21:49
-
-
Save rodica-andronache/5677242 to your computer and use it in GitHub Desktop.
WORDPRESS - Custom fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sunt campuri pe care le poate completa cel care creeaza un post, in wp-admin, pe care le poate folosi in alt scop decat textul atasat postului. | |
Sunt de forma key/value. | |
Cum se creeaza: | |
- pe pagina de adaugare post, in wp-admin, dau la 'Custom Fields' (daca nu apare, e posibil ca e hidden si ma duc in dreapta sus, la Screen options, si activez Custom Fields). | |
- completez campurile de Name si Value si dau Add Custom Field | |
Obs: Dupa ce completez primul custom field, data viitoare, la name, o sa apara un dropdown list cu toate optiunile pe care le-am pus deja, din care pot sa aleg, sau pot adauga unul nou. | |
Cum se afiseaza: | |
- the_meta() - in interiorul loop-ului, afiseaza custom field-urile postului curent(care sunt "post meta" postului). | |
Output from the_meta: | |
<ul class='post-meta'> | |
<li><span class='post-meta-key'>your_key:</span> your_value</li> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment