David Lee
  • Member for 5 years
  • Last seen more than a month ago
  • Santa Cruz de la Sierra, Santa Cruz Department, Bolivia
How to put logs in wordpress
Accepted answer
68 votes

You can enable WordPress logging adding this to wp-config.php: // Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', ...

View answer
Passing arguments to my function with do_action and add_action is not working
Accepted answer
2 votes

You are doing the do_action before the action is add, try moving it: $name = "link"; add_shortcode($name, 'aa_link_shortcode'); function shorcode_resources($var1) { global $post; $...

View answer
Prevent non-admin to add/create new pages
1 votes

You can remove the capability using remove_cap, here you can see a list per role of all capabilities available, the one you want would be edit_pages, so this will work for the editor rol, which has ...

View answer
Why is my Wordpress loading old version of JQuery?
2 votes

Its made like that for backward browser compatibility, if you want the latest version of Jquery, you will need to deregister the script and register it with a new source, you can use a CDN or save the ...

View answer
wp_register_script multiple identifiers?
Accepted answer
4 votes

To have the JavaScript Libraries not to load since you already created a bundle of them, do the following: Asumming the following, usual enqueue: function the_js() { wp_enqueue_script('bundle_js'...

View answer
How can i trigger an action manually?
Accepted answer
3 votes

Use do_action, you can just: do_action( 'my_action'); if your action has a callback function that need arguments say: function my_callback( $an_array ){ //use the array for something here ...

View answer
Will renaming a `content.php` file cause any problems?
Accepted answer
3 votes

There shouldnt be any issue, dont forget to change the slug in the template part call: get_template_part( 'format', get_post_format() ); the best practice is to have them in their own folder: ...

View answer
How to call a static function in add_action() inside another static function?
Accepted answer
1 votes

If your class is called statically you need to use get_called_class() like this: add_action('wp_enqueue_scripts', array( get_called_class(), 'set_bootstrap' ) ); since $this is not available. This ...

View answer
How to get the name of the homepage's menu?
Accepted answer
1 votes

You can use get_nav_menu_locations() to get an array of locations that are being used (a menu has been assigned to it), it shows like this: Array ( [header-menu] => 4 [extra-menu] => 6 )...

View answer
Make user's name display as the site name in comments if it matches certain roles
1 votes

If you are searching to modify the listing of comments, check wp_list_comments() just like the nav menu you can modify it using a walker: wp_list_comments( array( 'walker' => new ...

View answer
Using track metadata from audio shortcode
Accepted answer
2 votes

Yeah, you can access that data using get_post_meta, remember that almost everything in WordPress is a type of a post, an audio its a wp_attachment type, you just need the ID, also you can make a ...

View answer
Registering a script dilemma→ wp_register_script
0 votes

you cant leave it empty, at least you have to put an empty string '', it will default the dependency to array() and the version to false: wp_register_script( 'scroll', get_template_directory_uri() . '...

View answer
Active Current Menu - Adding class to child theme
0 votes

The default menu in WordPress already adds classnames for the current menu item, and if its a submenu, the parent will have a classname too as current-parent: li.current-menu-item{ //here your CSS ...

View answer
Using Wordpress to create a simple web app (SaaS)
0 votes

Use the Multisite option of WordPress, so each user has his own site, install a theme that its a SaaS, install a plugin to restrict the site to logged only or just use is_user_logged_in() (not sure if ...

View answer
Get custom fields from a custom post type with a shortcode
Accepted answer
1 votes

Get the Attribute value in the shortcode and get the custom field values: function product_func($atts) { $post_id = $atts['code']; $key = "my_custom_field_key";//for 1 field, you can do this ...

View answer
How to target children of child pages
Accepted answer
2 votes

Add this CSS rule to your stylesheet: ul.menu ul.sub-menu ul.sub-menu li{ //special styling here } its the default CSS classnaming WordPress use for the menus, you can see how i add it here.

View answer
How to fix that new users show up again in subsite of a Multisite?
1 votes

That its expected behaviour, you have to manually add the user to the site and select his role, you go to All Sites, Edit a site, then select the Users, tab:

View answer
Best way to salvage a very old WP site
1 votes

You will have to scrape the site for the data, or better if you have back-end access so you export the data in a file, then checking the file you can modify it to make it ready for import in the ...

View answer
Change Password Hint
Accepted answer
5 votes

Just add a filter, where you can change the text, like this: add_filter( 'password_hint', function( $hint ) { return __( 'MY OWN PASSWORD HINT' ); } ); This can be added in functions.php in your ...

View answer
create drop down menu
Accepted answer
1 votes

What you are searching for its a submenu page. Try with this: add_submenu_page( 'my-top-level-slug', 'My Custom Submenu Page', 'My Custom Submenu Page', ...

View answer
How to load all plugins CSS after child theme CSS?
3 votes

You have 3 options: Option 1: Using dependencies, first of all get the style handler, if you have access to the file you can grab it from the wp_enqueue_style function, if not, inspect the HTML code ...

View answer
How can I activate custom fields checkbox in pages?
1 votes

You will find the option when editing the page, just click in the Home link: select it there and it will be for all the pages from now on:

View answer
Wordpress Child theme fails to override parent theme css
Accepted answer
1 votes

I see the issue, there is a second call to main.css : <link rel="stylesheet" id="faxhion-css" href="http://www.rareselect.co.uk/wp-content/themes/faxhion/main.css?ver=4.8.1" type="text/css" media="...

View answer
How do I move the sidebar more to the right in TwentySeventeen?
Accepted answer
2 votes

You have 2 options: Option 1. Just add negative margin to the sidebar CSS like this: @media screen and (min-width: 48em){ #secondary{ margin-right:-150px; } } Option 2. Add more ...

View answer
Set Condition echo function get_post_meta
0 votes

From your code, this is the part where you can get the mark, modified to get only one: $member_id = get_current_user_id(); $course_id = 1; //i am assuming the ID of the course $status =...

View answer
Copyright info change in Theme Child PHP
Accepted answer
1 votes

You need to modify 2 functions not only 1 in your functions.php: /** * Function to display footer content. * * @since 1.1.24 * @access public */ //ADDED CHILD TO THE END OF THE NAME function ...

View answer
Country-specific content
0 votes

you have 2 options based on the volume of the content: If the specific content for a country its a lot and users need to be separated by country, create a Multisite, a site for each country: |-...

View answer
Allow registering user to select post category when signing up to blog
0 votes

You can add a new field in the registration form Customizing the Registration Form after that, you can add a function to the save_post action with add_action('save_post', 'set_category_by_username'); ...

View answer
How to use thumbnail size of image if I'm only using src to get image
0 votes

Since you are using get_sub_field() i assume you are inside a have_rows() (a repeater), in theory it should work like this: $image = get_sub_field('image'); <img src="<?php echo $image['url']; ?...

View answer
My own theme's custom widget areas are not working
Accepted answer
0 votes

I fixed your functions.php code: <?php add_theme_support('post-thumbnails'); add_theme_support('menus'); /** * Enqueue scripts * * @param string $handle Script name * @param string $src ...

View answer
1
2 3 4 5