Is it possible to remove the main rich Text box editor?
see remove_post_type_support function remove_pages_editor(){ remove_post_type_support( ‘page’, ‘editor’ ); } add_action( ‘init’, ‘remove_pages_editor’ );
see remove_post_type_support function remove_pages_editor(){ remove_post_type_support( ‘page’, ‘editor’ ); } add_action( ‘init’, ‘remove_pages_editor’ );
You can use get_the_title() to return the current post title in the loop.
You can simply use var_dump() to do this. That is how I check values inside functions and filters. I have the following line of code in a file which I simply copy and paste where needed to dump the value of a variable ?><pre><?php var_dump( $variable_to_test ); ?></pre><?php The pre tags dump a nice readable … Read more
You have a basic mistake in your code. The following code if ( !is_page(‘my-page’) ) { means that if you are not on that page, deregister the scripts. Have a look at the php operators ! -> Not !$x True if $x is not true Also, why not exclude this specific page when you initially … Read more
Well, I’d say that you need a custom plugin. All the rationale is in this Q&A: Where to put my code: plugin or functions.php? Also related: Where do I put the code snippets I found here or somewhere else on the web? Create a Functionality Plugin Instead of Using Functions.php And answering to the Question, … Read more
This is what you need, taken from – https://stackoverflow.com/questions/27087772/how-can-i-change-meta-alt-and-title-in-catalog-thumbnail-product-thumbnail add_filter(‘wp_get_attachment_image_attributes’, ‘change_attachement_image_attributes’, 20, 2); function change_attachement_image_attributes( $attr, $attachment ){ // Get post parent $parent = get_post_field( ‘post_parent’, $attachment); // Get post type to check if it’s product $type = get_post_field( ‘post_type’, $parent); if( $type != ‘product’ ){ return $attr; } /// Get title $title = get_post_field( … Read more
The files in wp-admin are only loaded when you’re in the admin area… when you’re looking at pages or posts those functions aren’t loaded. In that case you’d need to require the file first, so you’d want to do something like this in your function: if ( ! is_admin() ) { require_once( ABSPATH . ‘wp-admin/includes/post.php’ … Read more
Its an old question however would like to answer for other people Within ajax function hooked to wp_ajax do this. $url = wp_get_referer(); $post_id = url_to_postid( $url );
Here’s an example: Use this sample JavaScript code: jQuery(document).on(‘click’, ‘.some-element’, function(e){ var ipc = jQuery(this).data(‘collection-id’); jQuery(‘.some-other-element’).show(); jQuery.ajax({ method: ‘post’, url: ipAjaxVar.ajaxurl, data: { collection_id: ipc, action: ‘my_function’, } }).done(function(msg) { // Do something when done }); e.preventDefault(); }); PHP (include the function in your plugin, do not use a separate file): // Include the JavaScript … Read more
Do you search for $args[‘widget_id’]? Just save it in a variable you can access in form() later. Look at wp-includes/default-widgets.php to see how widgets work. Not the best code, but it should give you some hints.