Insert Content Before div#main from the functions.php File

The markup surrounding the content is not specified by WordPress, so there is no hook for that. But you can declare your own hook there. In your template file, write … <?php do_action( ‘before_content_container’ ); ?> <div class=”main”> <?php the_content(); ?> </div> <?php do_action( ‘after_content_container’ ); ?> … and then you can register a callback … Read more

Changing where my author box is printed

You could change the function to echo like this: echo apply_filters(‘the_content’, $content); and then in your template, right before the comments template, place the call to your author box function like this: author_info_box(); also, you would need to remove the add_action(‘the_content’, ‘author_info_box’); Full function example: function author_info_box() { global $post; // Detect if it is … Read more

the_content() Not Grabbing All Content

Try calling the_post() at the top of the file before calling functions like the_title() and the_content() If that doesn’t work, then most likely you have a function on the the_content filter that is causing this problem. Try disabling the plugins you have installed one by one to see if that fixes the problem

Add div before the first paragraph the_content [closed]

Yogenisia’s is right that you should use the_content filter. If you want to insert something before the first paragraph, locate the first <p> in $content, then insert your div with substr_replace. add_filter( ‘the_content’, ‘namespace_insert_before_first_paragraph’ ); function namespace_insert_before_first_paragraph( $content ) { $my_div = ‘<div> … </div>’; $first_para_pos = strpos( $content, ‘<p’ ); $new_content = substr_replace( $content, … Read more

first paragraph of the_content as meta description

You can use the_excerpt() instead of the_content Reference link for filter your excerpt : show-first-paragraph Or you can also do this by callback function inside your loop using the function to modify the_content as below: function get_first_paragraph(){ global $post; $str = wpautop( get_the_content() ); $str = substr( $str, 0, strpos( $str, ‘</p>’ ) + 4 … Read more

Separate Content from gallery (custom post type)

You can do something like this <?php get_header(); ?> <section id=”content”> <div class=”container”> <?php get_template_part(‘inc/page-title’); ?> <div class=”row”> <?php if (have_posts()) : ?> <?php /* Start the Loop */ ?> <?php while (have_posts()) : the_post(); ?> <div class=”col-sm-7 post-thumb large-thumbnail”> <?php the_post_thumbnail(‘model-full’, array( ‘class’ => “img-responsive” )); ?> </div> <div class=”col-sm-5 entry-content profile”> <?php $properties … Read more

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