Include a php file from another plugin
Including a PHP file requires to provide its exact file path, not the URL. Try this instead: include_once( WP_PLUGIN_DIR . ‘/plugin-name/classes/event.php’ ); Hope it helps.
Including a PHP file requires to provide its exact file path, not the URL. Try this instead: include_once( WP_PLUGIN_DIR . ‘/plugin-name/classes/event.php’ ); Hope it helps.
Given that you want to include a picture in the wp_nav_menu output, your best bet is to use the wp_nav_menu_items filter, as suggested in the comments. This will allow you to do a search and replace on the html. add_filter (‘wp_nav_menu_items’,’wpse229358_filter_menu’); function wpse229358_filter_menu ($items,$args) { $search=””; // html string of button $replace=””; // html string … Read more
You can add stylesheet in back-office, but you need for that use the admin_enqueue_scripts action. See Codex reference : https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts
When you are concatenating string you shouldn’t use ;after the method. Also you should close que quotes, call the method, and open again. Try the code below: $listItem .= ‘<div id=”agenda-block-image-responsive” style=”‘ .get_field(‘speaker-img’ ) . ‘”>’;
Sure. In your single.php or where you loop through the posts, start by getting the content: $content = get_the_content(); Then use a regex where you target anything within <h2> tags: $regex = ‘/<h2>(.*?)\<\/h2>/u’; And then use preg_match_all() to find all titles: preg_match_all($regex, $content, $table_of_content); This will create a multidimensional array, see: print_r($table_of_content); So you have … Read more
1 – it’s up to you and subject to opinion, so not best suited to WPSE. 2 – Never hardcode paths. WP has whole range of functions for finding file paths and URLS. plugins_url() will get you the full URL to the plugins directory, handling whether you are using http or https and canonicalising the … Read more
This is a pretty broad question, but I will still try to answer it. WordPress is a mature platform so you won’t see many changes between 3.5 and the current version that would require you to learn from scratch. The basics of WordPress are still the same with some additional features that will make your … Read more
When dealing with submit forms, even if they are sent with AJAX, you must play by the Never trust user’s input rule. Every data-attribute can be changed, edited via Inspector. Your only trusted validation should be on the server side, as you did with: if ( isset($_POST[‘author_id’]) || is_numeric($_POST[‘author_id’]) ) Personally, I would inverse the … Read more
As I understand your question, you want to Update a GF field with the results ($distance) of an AJAX request. If that is correct, on a successful AJAX request, you just need to update the value of your GF field. Assuming your response is the actual value correctly formatted. here’s what you need to do. … Read more
Please follow the following steps to make first commit in wordpress.org Please install SVN in your System. Make a folder in your computer so that you can upload Plugin content from this folder to WordPress Repository. (i.e. plugin folder in d: drive) But please do not use your this folder localhost/example/wp-content/plugins/your-plugin-name. Please check your mail … Read more