Starting with v2.0 (April 25th, 2013), PHP Melody has the ability to assign custom fields to each video, article or page. This extra data is also known as meta data and it can include data such as:
- Artist: Michael Jackson
- Speaker: Thomas K.
- Episode: #7
- Season: #2
- Video Part: #1
These are merely a few examples of the possible uses for ‘custom fields’ or, as otherwise known: meta data. Custom fields are user defined, meaning you can define any meta data relevant to the video, article or page posted.
Custom fields come in name/value pairs. The name is the identifier while the value is the actual information you wish to display on the page. In the first example, “Artist” is the name while “Michael Jackson” is the value.
Custom Fields Usage
Assuming we have a music video website, we’re going to add a new ‘custom field’ named artist. The following steps need to be taken to add the new ‘custom field’:
- After you’ve added/edited your video scroll to the bottom of the page to the area titled Custom Fields.
- In the first text field, titled ‘Custom name’, enter artist and in the second text field, titled ‘Custom value’, enter “Michael Jackson” or the artist associated with the video.
- Click the Add Custom Field button to assign this ‘custom field’ to the video before saving.
The next time you post a video you can select the alredy created artist field by clicking the ‘Select Existing Field’ link within the Custom Fields form.
You can add as many custom fields as your site requires.
Displaying Custom Fields
Once defined, you will have to output the value for this new ‘custom field’ on the actual page your visitors will see. This can be done by inserting some additional code into your theme. In our case, we will add the artist filed in the title of the page after the video name.
For this, we need to edit the /templates/default/video-watch.tpl file:
—————[ FIND ]—————
<h1>{$video_data.video_title}</h1>
—————[ REPLACE WITH ]—————
<h1>{$video_data.video_title} {get_video_meta video_id=$video_data.id key='artist'}</h1>
As underlined in the replacement code, the KEY was set to the ‘Custom Name’. In our case it was artist, as previously defined in the Admin Area (video editing/adding form).
If we define another custom field, named season, we will use:
{get_video_meta video_id=$video_data.id key='season'}
This code can be placed anywhere in the video-watch.tpl file and even styled with some CSS afterwards.
Note: this example was for a video page. To use the custom fields on an article page (i.e. article-read.tpl), the code would be:
{get_video_meta video_id=$article.id key='season'}
Additional usage
If you have more than one custom field, you can list them all in an ordered list (<ul>) by using this following code in video-watch.tpl:
{get_video_meta_list video_id=$video_data.id}
or in article-read.tpl:
{get_article_meta_list article_id=$article.id}

Leave a Reply to registri akashici lettura registri akashici cos’è i registri akashici come accedere ai registri akashici lettura registri akashici online lettura registri akashici a distanza messaggi dai registri akashici consulto registri akashici guida registri akashici viaggio nei registri akashici lettura libro dell’anima risposte dai registri akashici lettura tarocchi consulto tarocchi online tarocchi amore lavoro futuro tarocchi professionali lettura sibilla sibilla regionale cartomanzia sibilla consulto sibilla online tarocchi per l’amore tarocchi per il lavoro risposte dai tarocchi tarocchi e cartomanzia professionale lettura carte divinatorie corsi spirituali online corsi crescita personale e spirituale corsi registri akashic i corsi karma corsi fiamme gemelle corsi di cartomanzia corsi sibilla regionale corsi lettura carte corsi spiritualità online corsi risveglio spirituale corsi intuizione formazione spirituale online fiamme gemelle cos’è una fiamma gemella come riconoscere la fiamma gemella segni fiamma gemella percorso fiamme gemelle riunione fiamme gemelle separazione fiamme gemelle dolore fiamma gemella amore incondizionato fiamma gemella fasi fiamme gemelle fiamme gemelle e risveglio legame fiamme gemelle cos’è il karma karma vite passate scioglimento karma karma positivo e negativo karma spirituale come liberarsi dal karma karma e relazioni legami karmici karma e destino corso sul karma consulti spirituali online guida spirituale crescita personale e spirituale percorsi di consapevolezza risveglio dell’anima messaggi spirituali evoluzione animica lettura energetica corsi per l’anima Cancel reply