Getting post content without the navigation

the_content() will output the formatted post to the web browser, if the tag is used in the post it will only display the post up to this point and will out put a “Read More” link. There are some additional flags in the method to control this behaviour. See more here. Alternatively, you may load … Read more

How to parse shortcodes within returned content

Here’s the code given by the VC team. And it works. // display content in grid add_filter( ‘vc_grid_item_shortcodes’, ‘my_module_add_grid_shortcodes’ ); function my_module_add_grid_shortcodes( $shortcodes ) { $shortcodes[‘vc_post_content’] = array( ‘name’ => __( ‘Post content’, ‘fluidtopics’ ), ‘base’ => ‘vc_post_content’, ‘category’ => __( ‘Content’, ‘fluidtopics’ ), ‘description’ => __( ‘Show current post content’, ‘fluidtopics’ ), ‘post_type’ => … Read more

Password protection for page template

This is because password protection applied on get_the_content() function. And you are not using it instead you’ve written your own custom loop. So you can alter the code before loop and check if page is not password protected using function post_password_required() and then display form using get_the_password_form() else display loop. Example:- if ( post_password_required( get_the_ID() … Read more

Redirect All Search Links Containing – to + on WordPress

You can do something like the following at the top of your .htaccess file to replace all – with + that occur after the /search/ path segment in the requested URL: RewriteRule ^(search/[^-]*)-([^-]*-.*) /$1+$2 [N] RewriteRule ^(search/[^-]*)-([^-]*)$ /$1+$2 [R=302,L] The first RewriteRule loops (internally) until all except 1 hyphen has been replaced with +. The … Read more

Adding current user’s ID to the end of PDF hyperlinks in post content

Here’s a solution that I came up with that will add the user query argument and the current user’s ID to PDF links, e.g.: http://mysite/wp-content/uploads/2018/12/My_PDF_File.pdf?user=54 This code works by inspecting the post’s content using the the_content filter, then parsing the content using DOMDocument. I’ve run into various gotchas using DOMDocument and much of this code … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)