How to show Social share buttons outside the post?
i am using astrid theme so we have to put this code below 49 line in class=”entry-summary” wp-content\themes\astrid\template-parts\content.php
i am using astrid theme so we have to put this code below 49 line in class=”entry-summary” wp-content\themes\astrid\template-parts\content.php
We can drop this question, please. The page probably loops when it lists itself. I must just find a way to exclude listing itself. Sorry. This is what was missing $args = array( ‘post_type’ => ‘post’, ‘post__not_in’ => array(get_the_ID()) );
PHP-side you can pass the post_content to the parse_blocks() function which will provide you with an array of associative arrays representing each block. Similar functionality is offered JS-side in the form of the wp.blocks.parse() function from the @wordpress/blocks package. For illustrative purposes, here is a var_dump() of that output for the default “Sample Page”: array(9) … Read more
Using str_replace on the_content and the_excerpt, but not working on archive index pages
so you can do that with the use of custom fields, you can use custom fields, to add images and videos check this answer it might help you
Truncate the_content to your desired length, check if the last character is a < and remove it if so, then pass it to force_balance_tags, which will close any opened html tags.
could you post your template code? Maybe there is an error in your html. some unclosed tags or something. also what result does this give you? is it also empty? $content = get_the_content();
You can temporarily remove the filter that adds paragraph tags: // remove the filter remove_filter( ‘the_content’, ‘wpautop’ ); // output content the_content(); // add the filter again add_filter( ‘the_content’, ‘wpautop’ );
I would say the best way to do this is using the save_post action, which is run every time a post is modified in edit screen. It will require a fair bit of fiddling when writing and reading post_content to/from the database. In the example below I add a list of post tags to post_content. … Read more
Limiting the content to a number of words is a little tricky. Limiting the number of characters is much easier to do and is built in to WordPress already. You can use the the_excerpt() and get_the_excerpt() functions to limit the number of characters in the beginning of the post content. The example in the first … Read more