Problem with content – not loading

The error message you get means that a function has been hooked without a valid callback. In other words it means that somewhere in your theme or in a plugin a function has been set but it’s not “hooked” properly. See the example : function add_post_content() //<- the callback { // blabla } add_action( ‘hook_name’, … Read more

Change default italic from to in admin editor

Are you sure editor use <i> for italics? I’m almost sure it uses <em>. However, if you want to be absolutely sure there are no <i> in your post content, let editor do what it want and then replace <i> with <em> before creating/updating posts, hooking wp_insert_post_data filter, just like: add_filter(‘wp_insert_post_data’,’replace_em’, 20, 1); function replace_em( … Read more

How to get a post’s content? [closed]

“best” greatly depends on context. guid is probably (with some debate about it) the best way to uniquely identify a post, but not all import/export plugins leave it alone without changes. ID is a good identifier if you do not care about import and export. Slug is problematic because they might be changed by the … Read more

the_excerpt() in content.php and get_template_part() in single.php

the_content() does not grab the PHP file content.php, it simply displays a Post’s content. Likewise, the_excerpt() grabs the excerpt of a post. get_template_part simply finds a file within your theme named whatever you put in, with an optional suffix. get_template_part( ‘content’ ); // content.php get_template_part( ‘content’, ‘my_page’ ); // content-my_page.php in order for make different … Read more

WordPress page content outside WordPress

The alternative way. Problem with @david.binda solution is that: you have to hardcoding a lot of things, (manually write db credientials, table prefix..) You cannot use content filter (so if you have shortcode in your page, you will see some [something] instead of desired content..) sure you can load wordpress environment, but… Just yesterday I … Read more

How do I find PHP file that contains content of my page?

You are under a fundamentally wrong assumption: The content you input via the administrative back-end does not live in a file, but in the database, specifically in the wp_posts table. Do not be misguided by the table’s name, a “page” is technically a post of type page. If you attempted to find the content you … Read more

How do I display an image before the first post of the loop when I’m using get_template_part?

The variable $count is accessible in the scope of the current function only. So whatever happens inside get_template_part() cannot know that variable. You could use a global variable, which is accessible everywhere as $GLOBALS[‘count’]. But then you risk collisions with plugins and maybe other code. I recommend a helper function for the functions.php: /** * … Read more