- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hello friends css-strick,
I wanted to count the number of words in the quote so I could set the font-size based on that. As can be seen in quotesondesign.com
Chris Coyier posted about this in digwp.com/2009/07/putting-the_content-into-a-php-variable /
I do not know if Chris Coyier is using:
ob_start(); the_content(); $content = ob_get_clean();
or by using the:
get_the_content ();
Unlike quotesondesign.com, I’ll be using more than one sentence on the same page.
I’m just a beginner in php and WordPress, any help will be very helpful.
Note: Question translated from the Portuguese language with GoogleTranslate.
Ok, karlpcrowley. Thank you very much for your help!
But unfortunately I’m just a beginner in php and WordPress. How would I implement this in the_content? I would have to create a function functions.php? Could you give more details, please?
Ok, Robskiwarrior. Thanks for your help.
This code actually does the work. But it involves the entire contents with a single div. But my case is slightly different: I have a few paragraphs in my content and would like the word count was made in each paragraph and each paragraph have the font size set according to the amount of words.
It may be easier with jQuery/JavaScript. See this script:
The problem is that this script only works with this structure:
Lorem ipsum
Lorem ipsum
It does not work eg with this structure:
Lorem ipsum
Lorem ipsum
You or someone expert in Javascript/jQuery could give me a light?