Ready to get started?Download WordPress


How to modify the default caption layout (7 posts)

  1. whoaloic
    Posted 3 years ago #

    Hello, I use Twenty Eleven theme and I would like to change the default caption layout.
    For now, I've succeed to ignore the dash character which appear next to the caption thanks to css :

    .wp-caption .wp-caption-text:before {
    	content: '';

    But I would like to use
    blockquote tag instead of <p>.
    Any help would be much appreciated!

    [Please post markup snippets between backticks or use the code button.]

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Do not edit the Twenty Eleven theme. It is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. Create a child theme for your changes.

  3. you need to re-write the caption shortcode (new code added to functions.php of your theme or in a plugin) to do that.

    what is the purpose ?

    you could emulate the look of a blockquote by adding new css to style.css of your child theme.

  4. whoaloic
    Posted 3 years ago #

    Yes but I have styled blockquote tag and I would like to use that style!
    So instead of using p tag, I think it would be easier to use blokcquote tag instead of style p tag in caption.
    I dont find caption shotcode. Where is it?

  5. it is way more complicated to re-write the caption code than to restyle the paragraph within .wp-caption-text p to look like your blockquote. (full stop)

    the caption code is in /wp-includes/media.php from line707;

    do not edit wp core files.

  6. whoaloic
    Posted 3 years ago #

    Can I copy the same function in my child theme function file ?
    I mean, using a function that will don't take care of the function in the core files but will take care of the function in the child theme file?

    I hope I was clear...

  7. try to add this to functions.php of your child theme:


Topic Closed

This topic has been closed to new replies.

About this Topic