Change the first class if post page is 1
-
Hi, I’ve found this function:
function first_paragraph($content) { if(is_single()) // make paragraph bold for single pages only { return preg_replace('/<p([^>]+)?>/', '<p$1 class="lead">', $content, 1); }else{ return $content; } } add_filter('the_content', 'first_paragraph');
How to modify it to change the class of the first <p> only on the first page of the post (divided into pages using the <!–nextpage–> tag (replace the is_single condition)?
For post pagination/navigation I’m using the following script:
https://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination-without-plugin
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Change the first class if post page is 1’ is closed to new replies.