Adding custom directory and PHP files in wordpress

The github repo seems to be a custom code that you need drop into your theme directory, update your config file using your twitter credentials and try putting this code inside the body in any of your intended theme files that you will use(eg, index.php) <h1>Tweets of a certain user</h1> <div class=”stream”> <h2><span>Twitter</span></h2> <ul class=”timeline”></ul> … Read more

How to provide a plugin which requires CMB2 (plugin dependencies)?

On your plugin activation hook method you can check if CMB plugin is installed and/or activated. You can check this using the following methods: is_plugin_active(): only available from within the admin pages function_exists() or class_exists(): available anywhere once they are PHP core methods If CMB is not installed, you can throw an error message in … Read more

Where to save common libraries?

I would recommend creating a plugin that holds all of your libraries. In the main plugin file, set a constant that defines the path to the plugin folder so you can easily include the files with your other plugins/themes.

Including a 3rd party library in WordPress which needs to be accessible by wp-config

1st, the key should be generated once, not per request. The tutorial is suggesting you generate it via the library (probably via cli, or one off script you run in the browser) and then simple add: define(‘JOSH_ENCRYPT_KEY’, ‘the-random-key-you-generated-gets-copy-pasted-in-here-manually’); into your wp-config.php file, so you dont need the lib to be in scope at that point. … Read more

How to get an image url from media library

You have to convert attachment variable to JSON object using toJSON() . Then you can its property. use attachment = frame.state().get(‘selection’).first().toJSON(); instead of attachment = frame.state().get(‘selection’).first();

Disable edit option in Media library

There’re several filters that you can utilize: Custom column content If you got a custom column that you added with the “-filter, then you can use the manage_{$post->post_type}_posts_custom_column filter to alter the content. If you only want to target non-hierarchial post types then there’s as well the manage_posts_custom_column and for hierarchical ones, there’s manage_pages_custom_column. All … Read more

Way to display media library in frontend

As far I’ve understood with those I’ve written a simple system for you. Please put the below codes in your functions.php– add_action( ‘wp_enqueue_scripts’, ‘the_dramatist_enqueue_scripts’ ); add_filter( ‘ajax_query_attachments_args’, ‘the_dramatist_filter_media’ ); add_shortcode( ‘the_dramatist_front_upload’, ‘the_dramatist_front_upload’ ); /** * Call wp_enqueue_media() to load up all the scripts we need for media uploader */ function the_dramatist_enqueue_scripts() { wp_enqueue_media(); wp_enqueue_script( ‘some-script’, … Read more

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