-
Notifications
You must be signed in to change notification settings - Fork 2
get_the_identifier
get_the_identifier()
returns the unique identifier string for this slide. (the_identifier()
prints it.)
Please note that while the identifiers are currently generated by PHP's uniqid()
, this format is not guaranteed in the future, so your templates must not assume anything about the format that this_identifier()
prints.
Normally you would call $s->the_identifier()
inside your $s->has_slides()
while
loop.
Security Note: get_the_identifier()
returns sanitised data, but if you use later mix the results of get_the_identifier()
with some other kind of user-supplied input, it is vital that you run that result through WordPress' esc_html()
, esc_attr()
or esc_js()
functions, depending on where you are going to output the data.
None.
Simple usage:
<?php while ($s->has_slides()): ?>
<li>
<div id="ts-mytemplate-<?php echo $s->get_the_identifier();?>">
<h1><a href="<?php $s->the_link();?>"><?php $s->the_title(); ?></a></h1>
</div>
</li>
<?php endwhile; ?>
Would output, for example:
<li>
<div id="ts-mytemplate-4faa26fcebcb7668442103">
<h1><a href="http://example.com/2012/lorem-ipsum">Slide one title</a></h1>
</div>
</li>
<li>
<div id="ts-mytemplate-4faa26fcebcb7668443103">
<h1><a href="http://example.com/2012/etian-at-risus-et">Slide two title</a></h1>
</div>
</li>
<li>
<div id="ts-mytemplate-4faa26fcebcb7668674210">
<h1><a href="http://www.vanpattenmedia.com/">Slide three title</a></h1>
</div>
</li>
... etc.