Extracting gallery images in WordPress 3.5 on index.php

get_the_content is a template tag and would only work reliably inside a Loop. That means that you should also be able to use the $post global instead. global $post; // may not be necessary unless you have scope issues // for example, this is inside a function $post_content = $post->post_content; preg_match(‘/\[gallery.*ids=.(.*).\]/’, $post_content, $ids); $array_id = … Read more

Post Content, Special Characters and Filters

Using a snippet of code like this: $hook_name=”the_content”; global $wp_filter; var_dump($wp_filter[$hook_name]); I was able to find a list of all hooked callback functions to the WordPress filter: the_content. I then located a few possible culprits, then searched for their function existence. After narrowing down my list, I came to the conclusion on the hooked callback … Read more

Get the_content with ajax

I’m sorry but I think you have not read a good tutorial. If you are new to WordPress AJAX, I recomend you reading AJAX in WP Codex and examples plus all the examples you can find in this site.

How to add pagination in between post and comments?

I got my solution. <?php // move pagination links above other end-of-post content additions, like related posts etc. function move_pagination( $content ) { if ( is_single() ) { $pagination = wp_link_pages( array( ‘before’ => ‘<div class=”page-links”><span class=”page-links-title”>’ . __( ‘Pages:’, ‘firmness’ ) . ‘</span>’, ‘after’ => ‘</div>’, ‘link_before’ => ‘<span>’, ‘link_after’ => ‘</span>’, ‘echo’ => … Read more

Only display videos and images in the_content() within loop

We can do that with the help of the get_media_embedded_in_content() function: /** * Display only the first media item in the content * * @link http://wordpress.stackexchange.com/a/199398/26350 */ ! is_admin() && add_filter( ‘the_content’, function( $content ) { // Get the avialable media items from the content add_filter( ‘media_embedded_in_content_allowed_types’, ‘wpse_media_types’ ); $media = get_media_embedded_in_content( $content ); remove_filter( … Read more

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