New answers tagged

3

"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 user. The best thing to do if you need to ...


-1

You can create meta box for additional information/data in your posts/custom posts and create the custom fields accordingly. You can create your meta box by using add_meta_box() function and create your callback functions to create custom fields and save it on database. See this article for more clearification, ...


0

Looks like I blocked my self out… I had an .htaccess with password protection running that prevented the script from accessing the file.


1

You should use WordPress's built in function wp_enqueue_style for loading styles. /** * Proper way to enqueue scripts and styles */ function wpdocs_theme_name_scripts() { wp_enqueue_style( 'style-name', get_stylesheet_uri() ); wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); } ...


0

1) If you want default text in POST EDITOR, then use @Milo's answer. 2) If you want add default content in front-end output of post,then use this code (in functions.php): function add_before_content($content) { global $post; if ( 'page' == $post->post_type ) {return 'YOUR MESSAGE'.$content;} if ( 'post' == $post->post_type ) {return 'YOUR ...


1

I don't believe you can as a general rule just use a simplistic text search to find content even in Drupal. Any non-trivial data organization will probably use serialization, json encoding or totally separating the location of different parts of a data at different places of the DB or code and combining them when a page is generated. A leading element in ...


0

WP-Members™ is a free membership management framework for WordPress® that restricts content to registered users. For reference please have a look


2

The default email content type is text/plain which does not allow using HTML. Add this to your functions.php file: // use HTML instead of plain text add_filter( 'wp_mail_content_type', 'my_awesome_mail_content_type' ); function my_awesome_mail_content_type() { return 'text/html'; } But be warned, different email clients has very different support ...


1

You can use the_content with an high prioriety (lower number). add_filter( 'the_content', function( $content ) { return 'Hello World '.$content; }, 0); You can even use negative priority: add_filter( 'the_content', function( $content ) { return 'Hello World '.$content; }, -10); Note that this will apply everytime 'the_content' is used, no matter ...


1

There is no other global filter applied before the_content - you can use the $priority argument in your add_filter call to ensure your function runs before any others: function wpse_225625_to_the_top( $content ) { return "Hello World\n\n\$content"; } add_filter( 'the_content', 'wpse_225625_to_the_top', -1 /* Super important yo */ );


0

Your function is signup but you're hooking check_for_signup. You're also trying to apply the_content filters from within a function that's hooked to the_content: function wpse_225562_replace_for_signup( $content ) { if ( strcmp( 'signup_slug', get_post_field( 'post_name' ) ) === 0 ) { $content = 'Sign up, bitch.'; } return $content; } ...



Top 50 recent answers are included