New answers tagged

0

Yo don't need to write a plugin for that - what you need already exists. Check this link: https://wordpress.org/plugins/list-categories/ With this plugin you can display categories in any post or page. Of course, maybe you want to write your own plugin, and in that case this link can be helpful. I hope that this will help you to speed up a process.


0

I've modified your code to reflect the wp_list_categories() function reference as suggested by @Usce. This snippet will create an unordered list, remove the "Categories" list title, and add the li class with individual category ID so you can target each link in the list. function catting ($atts, $content = null) { echo '<div id="cats" ...


-1

There is build in wordpress function for that , so you can use wp_list_categories() for that. Please refer here to learn more And after you display them you an do some CSS if you want to display it as buttons. I hope this helps. Kind regards, Usce


0

You need to hook your function to delete_attachement hook, but you also need to remove some extra functions that are called before calling your hooked action to reach the right caller of wp_delete_attachment(). Here's a possible implementation... function my_backtrace( $post_id ) { $bt = debug_backtrace(); array_shift( $bt ); // Remove ...


0

Here is an alternative to your dirty coding/expert tricks. A WordPress plugin named WP Distraction Free View has been introduced with lots of amazing features. This plugin has a powerful admin panel with which you can customize the design of overlay as per the design of your website. Also, this plugin supports full-screen in dual mode(i.e. When user first ...


0

By removing the capability of deleting published pages and publishing pages, I have effectively stopped the admin from creating or deleting anything that is on the website. $role = get_role('administrator'); $role->remove_cap('delete_published_pages'); $role->remove_cap('publish_pages');


0

You could try GIF technology. This way, you won't need to unnecessarily write custom code. The post title is not the best place for multiple images when you could conveniently use a slider in the page's body.


-2

You can have some clue using the revision log. For more advanced logs, try using a plugin such Simple History


2

You can not replace the URL in the database using ctrl+f or any other "direct" method. You have to do a search & replace in the whole database in a way capable of keeping the validity of serialized data. There are several tools to do that serialized seach & replace. For example: Plugins like Better Search Replace, Velvet Blues Update URLs or ...


1

About your considerations:- Yes true! It will update the page on every visit. The database will be updated more frequently based on which user making a request. But there will be no incorrect output. The better way I suggest using a template_include filter. Assign a static front page then apply the template to that page by checking if user logged in or ...


0

It depends what you want to do. If you look into the function definition, you'll notice some do_action(): For example: do_action( 'delete_attachment', $post_id ); do_action( 'delete_post', $post_id ); do_action( 'deleted_post', $post_id ); These are points, called hooks in WordPress, where you can actually run your stuff. Hooks will help you to modify ...


0

If achieving this with a plugin is acceptable to you, an answer to a similar question recommended the Advanced Access Manager plugin.


0

get_the_date and get_the_modified_date use the date_format option set on the Settings -> General screen. Changing your date format there should change the date formatting returned by these functions without having to change TwentySixteen. You can also use the filters of the same names to conditionally filter the dates depending on conditions. For example, ...


0

if customizer(live preview) doesnt work or doesnt load and nothing is shown, try these steps: do you have redirections on the problematic site (double check and ensure, there might be coded a custom redirection in your plugins/codes)? while the circle is still loading, change any option in customizer and click "SAVE & PUBLISH" and see, maybe a simple ...


1

You need to prepend value stored in _subtitle to the content of the post so that it works. Please place following code in your theme's functions.php file and it shall work. Please let me know how it goes so that I may assist further: add_filter( 'the_content', 'prepend_subtitle_to_content' ); function prepend_subtitle_to_content( $content ){ $subtitle = ...


0

Don't know exactly what you are trying to accomplish using custom script.You can do this effectively in WP way using either shortcodes,page templates,plugin. Well if you don't want to do it that way and want to just place scripts in the active theme base directory.One way i suggest: Let's say we have two php files aform.php (Actual form page) and ...


0

Whatever you have in content-feature.php is going to be repeated for each article/post/feature. If you want all of them to be within the same <ul> you'll need to put everything else outside into the front-page.php main template. So: front-page.php if ( $loop -> have_posts() ) : ?> <ul> <?php /* Start the Loop */ ...


0

You can do this by using 'the_content' filter. That way, Wordpress will treat the content as it was came from the editor field and execute all the shortcodes: <?php $meta = get_post_meta($post->ID, 'intSlider', true); ?> <div id="sliderWrap"> <div id="slider" class="floatLeft"> <? echo apply_filters('the_content', $meta); ...


0

I'm assuming you're asking how to remove the first action, which the plugin has created? Removing an action is really easy - all you need to do is call remove_action like this: remove_action("admin_init", "backend_plugin_css_scripts_mail_bank"); Then add your replacement action. You need to ensure that you remove the action after it has been added ...


0

SOLVED! In response to @tomjnowell : Yep! you are right, I'm not giving enough details nor context, sorry. I'm not used to post questions here, nor the english is my mother tongue, as you can see. So thanks to be so patient as to help me. What I wanted What I intended is to make a search by several post meta AND, optionally, ALL the post meta PLUS the ...


0

Create a another filter to remove post title and post content remove search terms try this if this helpful for you add_filter( 'posts_search', 'custom_post_search_author_do', 10, 2 ); function custom_post_search_author_do($search, $query ){ if( ! empty($search) && $query->is_main_query() && !is_admin() ...


0

The parameter for meta query is meta_key, not just key (according to https://codex.wordpress.org/Class_Reference/WP_Query) Try 'meta_key' => 'autor' instead of 'key' => 'autor'


1

You could hook into the template redirect function. function my_page_template_redirect() { if ( isset( $_COOKIE["myCookie"] ) ) { if( $_COOKIE["myCookie"] == "en" ) { wp_redirect( 'you path' ); exit; } } } add_action( 'template_redirect', 'my_page_template_redirect' ); And you could better use ...


0

I think You have error on default value for setting, You write 'default' => 'fa-fa box' instead 'fa fa-box'. I can't find box icon on fontAwesome too.


0

Go with a custom Walker class Your_Walker_Nav_Menu extends Walker_Nav_Menu { var $container_class; public function __construct($container_class) { $this->container_class = $container_class; } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth > ...


0

So far i've tried pulling the value from the nav template. https://github.com/WordPress/WordPress/blob/master/wp-includes/nav-menu-template.php. I know it's related to $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"'; on line 353. The value returns null when ...


0

You can use post_name parameter. $my_post = array( 'post_title' => wp_strip_all_tags( $_POST['post_title'] ), 'post_content' => $_POST['post_content'], 'post_status' => 'publish', 'post_author' => 1, 'post_category' => array( 8,39 ), 'post_name' => 'your-url' ); wp_insert_post( $my_post );


-1

Seems like you might be looking for this button:


2

That looks like that's the Recent Comments widget in your sidebar. If so, go to Appearance -> Widgets in your site's admin and either delete the Recent Comments widget or drag it to the Inactive Widgets area.


0

You can either register the script and then enqueue it (which is how you're doing it above), or you can simply enqueue it all in one go. Either way, if your script requires jQuery, you should designate it as a dependency with your registration, so WordPress will know to load it automatically for you. So, either: wp_register_script( 'menuscroll', ...


2

By default WordPress use _wp_render_title_tag to hook wp_head ( see here ) add_action( 'wp_head', '_wp_render_title_tag', 1 ); This function is wrapper of wp_get_document_title to show title tag on theme if add_theme_support( 'title-tag' ); added in theme file functions.php ( commonly ). ...


0

In your header.php you may need to replace: <title><?php whatever code you find in your existing theme ?></title> with: <title><?php wp_title(''); ?></title> Make sure you make a copy first so you can revert back if you need to!


0

I have tried VA Simple Expires https://wordpress.org/plugins/va-simple-expires/ Works pretty well. Unfortunately Post Expirator plugin did not work for me because posts imported via CSV did not expire. Regarding VA Simple Expires - if you use CSV you should just add couple fields: scadenza-enable=1 scadenza-date=target time (e.g. 2016-04-10 00:42:00)


0

You put this code in your subdirectry .htacces <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /newsite/ RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /newsite/index.php [L] </IfModule> # END WordPress


0

Put this lines of code in function.php if (function_exists("register_sidebar")) { register_sidebar(); } Put this to sidebar.php <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> <?php $image = new WP_query ('showposts=1'); if(have_posts()) : while($image->have_posts()) : $image->the_post; ?> <a ...



Top 50 recent answers are included