• Hello everybody.

    I am beginner in wordpress, learning to create new themes. I want to build a row with 3 features blocks. I am using 3 pages for it. I would like to use the field description to insert the url, but in code always appear the url with p tag.

    Is there anyway, function or tip to clean the p tag in code? This is my code:

    
    < a>" title="<?php the_title(); ?>">
          <div class="small-12 medium-4 columns top-banner top-banner-<?php echo $contador ?>">
            <?php the_post_thumbnail(); ?>
            <h3><?php the_title(); ?></h3>
          </div>
    < /a>
    

    The function “the_content()” always bring the text inside a p tag and it build the url with p tag too.

    Thanks for help me, and sorry my bad english ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter comodo

    (@comodo)

    <a>" title="<?php the_title(); ?>">
          <div class="small-12 medium-4 columns top-banner top-banner-<?php echo $contador ?>">
            <?php the_post_thumbnail(); ?>
            <h3><?php the_title(); ?></h3>
          </div>
    </a>

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    • This reply was modified 7 years, 10 months ago by t-p.
    • This reply was modified 7 years, 10 months ago by t-p.
    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Thread Starter comodo

    (@comodo)

    Hi again, i think that is not what i need.

    I get this link

    /mydomain/<p>the_path</p>

    “the_path” is getting from content of post.

    I need to remove the p tag when i call “the_content()” from the template code.

    Thank you again.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    If you want a link to a post, use get_the_permalink(). At this point, I’m not clear what you want to do. You wrote “The function “the_content()” always bring the text inside a p tag and it build the url with p tag too.”

    What are you trying to do with the content of a post?

    Thread Starter comodo

    (@comodo)

    Hi again, sorry for the delay in answering.

    What i would to get is the next thing:

    I want to build a custom front-page. This page will have 3 featured blocks or banner linked to a different pages. I am using 3 post for building these blocks. Feature image of post for image of the banner, title of post for text title of banner, and i would like to use the description field of post to insert the destiny page.

    When i am coding i need to insert inside the href the value of description field of the post using the_content() function, but it allways bring me the content inside p tag. I would like to get the value of description field without p tag in this case.

    /mydomain/<p>destiny-page</p>

    The value destiny-page is inserted inside description field of the post.

    I hope you undertand what i want, thank you very much

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    What is “the description field”?

    Thread Starter comodo

    (@comodo)

    The content field of a post. Where you write the main content of a post.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    OK, then let’s refer to it as “the post’s content” instead of making up new terms. ??

    You do NOT want to put the content of a post inside an href. You want to show the content and make a “read more” link or perhaps link the featured image to the post.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Use field description for a link’ is closed to new replies.