• Resolved nspace1999

    (@nspace1999)


    Hello

    I have 10 custom files types. the slug is doc-sup-1, doc-sup-2, doc-sup-3. …..
    To create the links in front end, I use this :

    <?php for($i = 0; $i < 9; $i++): ?>
    <?php $link = types_render_field("doc-sup-".($i+1), ''); ?>
    <?php if($link != ""): ?>
    <a class="featured-more docpdf" href="<?php echo $link; ?>" ><?php echo substr ($link , (strrpos($link, "/")+1)); ?></a>
    <?php endif; ?>

    Is there a way to choose a name for the link in the post editor page ?
    Thanks a lot ..

    https://www.ads-software.com/plugins/types/

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can create 10 custom fields for titles. For example doc-title-1, doc-title-2, etc …

    You code would look like this:

    <?php for($i = 0; $i < 9; $i++): ?>
    <?php $link = types_render_field("doc-sup-".($i+1), ''); ?>
    <?php if($link != ""): ?>
    <a class="featured-more docpdf" href="<?php echo $link; ?>" ><?php echo types_render_field("doc-title-".($i+1), ''); ?></a>
    <?php endif; ?>
    Thread Starter nspace1999

    (@nspace1999)

    Hello

    Thanks for replying, but if I’m not wrong you wrote the same code as I did

    The code inside the Anchor tag changed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘display something else than file name for file type for link’ is closed to new replies.