Add custom columns in custom post type browse page

Here is an sample of my plugin’s code where I set a custom post type “aei_team_member” and add 2 columns (Prénom and Photo where Photo is a thumbnail) in admin list using : manage_${post_type}_posts_columns and manage_{$post_type}_posts_custom_column Further information can be found here: https://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column I hope it helped! /** * Adds a thumbnail column in the … Read more

how to replace hostnames on certain external links?

If the links are coming from the main content areas, you could create a hook which acts against this “content” output. In your themes functions.php file, you could try something like: add_filter(‘the_content’, ‘the_url_filter_function_name’, 30); function the_url_filter_function_name($content) { return str_replace(‘bad-url.com’, ‘good-url.com’, $content); } If the URLs you are looking to modify are being stored and output’d … Read more

Need to revert to an older version of wordpress

In order to downgrade your wp version , first download your desired version from the link below https://wordpress.org/download/release-archive/ Then follow the steps Deactivate all plugins Logout of wordpress Delete the WP-ADMIN WP-INCLUDES folders via FTP Transfer the files from the downngraded wp version to your site via FTP EXCEPT WP-CONTENT Now login to wordpress , … Read more

how to add a comment button to be displayed only for the posts in the home page [closed]

In the template part used in the loop on your home page, something like this should get you started. Someplace after the_content(); or the_excerpt(), depending on what you’re using. <?php if ( is_home() ) { ?> <a class=”button” href=”<?php echo esc_url( get_permalink() );?>#comments”> Comment Link Text </a> } ?> You can make it look like … Read more

WordPress plugin boilerplate table create

it is better you write like this: class My_Activator { public function jal_install() { global $wpdb; global $jal_db_version; $table_name = $wpdb->prefix . ‘fnotice’; $charset_collate = $wpdb->get_charset_collate(); $sql = “CREATE TABLE $table_name ( id INT NOT NULL AUTO_INCREMENT, msg varchar(500) NOT NULL, time DATETIME NOT NULL, type varchar(350) NOT NULL, link varchar(350) NOT NULL, status ENUM(‘0’, … Read more