Tag Info

New answers tagged

2

I hate OOP mixed in the functional structure of wordpress (here come the downvotes.....). If you use OOP just for name spacing then just use the name spacing feature of PHP, putting function in a class is just a very small part of what OOP should be. Anyway, your problems is that a there are only two way to refere to an class method, either when it is ...


4

You should be able to get the current logged in user ID and then use pre_get_posts to alter the main query on the home/blog page to only show posts from that specific user. As I understand, you are talking specifically about authors. You might want to also check the user's capabilities as well as simple subscribers won't see any posts on the blog/homepage ...


1

It's a css issue. You need to edit two selectors. First is the menu width. It's set to 100% which is why you're seeing black space. Edit this class below.: .cap-primary-menu .menu > li.menu-full-width .cap-submenu-ddown { padding: 20px 25px 25px; width: 100%; // set this to auto or something smaller than 100% left: 0; border: 1px solid ...


1

The only 100% way to get a paid subscription kind of service working is to move part of the functionality to an external server which is under your control and manage payment, expiry, etc there. When the code is not under your control you can not limit its use, this is a very basic life fact of software development, especially when the source code can be ...


2

If you're only managing a few sites and you're comfortable with the command line, you might want to look into wp-cli. With a little bit of scripting you can SSH into a remote server and do all manner of stuff like: Enable plugins: wp plugin activate acf-pro gravityforms wordpress-seo Check the versions, activation and update availability: wp plugin status ...


0

It is impossible to guess how is memory spent in your site. In context of WordPress it will simply obey PHP memory limit and will crash upon reaching it. Your description sounds more like the total of server memory, which isn't just WP, but everything on server (including web server software, database software, and so on). If that's the case 310 megabytes ...


1

I learned from the comments by @Pieter Goosen and @Ignat.B, and @Pieter Goosen's answer here, that I need to register the taxonomy on plugin activation, and insert the term. Then I need to hook the taxonomy registration code to the init action hook as suggested by the codex. This will ensure that when I insert the term on plugin activation, I have the ...


0

Fact is, it’s pretty ridiculous that WordPress has not developed a dashboard on its own. The nice thing about it being open source, however, is that the community - which consists of extremely talented developers and designers - has a terrific ability to create plugins like ManageWP that solve problems such as this http://managewp.com


1

May be you have just enabled the 'Enable shipping' from shipping options page(Woocommerce -> Settings -> Shipping ). You need to enable the Shipping Methods also. For enabling shipping methods click on shipping method name from shipping methods table displayed on shipping options page. Check the checkbox ' Enable this shipping method ' and save the ...


0

on the plugin activation hook, instead of doing everything right there just set a cron job that will do it.


0

If you are not agains using and installing plugins on all of your servers. Then MainWP can be of help. While they offer a lot more then what you ask for their plugin has some solid ways of managing other installs. MainWP is free and open source, yet they offer some paid extra's http://www.mainwp.com Alternatively you can use the XML-RPC to post to the ...


2

Yes it is possible, but there isn't much point in that. The crudest way is to use a filter on the result of getting the 'rewrite_rules' option, and manipulating it by adding the entries you require directly to the array, and then you might need to filter those rules out when the option is updated. The thing is that it is most likely a waste of time as as in ...


2

Nice sleuthing. Every single person on this SO site has been foiled by something exactly like this at one point or another with the WordPress template hierarchy. You might think of this backwards though. All the steps you found lead you back to the shortcode [pmpro_account] which gets output in the loop-myaccount.php by way of the_content(). That ...


1

If you dont want 'TopLevel' menu to represent a custom page you can use: add_menu_page( 'TopLevel', 'TopLevel', 'MENU_CAP_LVL', 'MENU_SLUG', 'MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu', 'SubMenu', 'MENU_CAP_LVL', 'SUB_MENU_SLUG', 'SUB_MENU_CB' ); add_submenu_page( 'MENU_SLUG', 'SubMenu-A', 'SubMenu-A', 'MENU_CAP_LVL', 'SUB_MENU_A_SLUG', ...


-1

You can easily handle via css. Like .class_name{ display:none; } Hopefully it will work for you.


0

Try use this (functions.php) : function product_title($id) { $custom='CustomField' return get_post_meta($id, $custom, true); } and call func in your template (in loop and etc...): <?php $p_title=product_title(get_the_ID()); ?> <h3>Product : <?php echo ($P_title); ?> </h3>


1

Use php dot notation. Try: $my_templates = get_stylesheet_directory() . '/lp/'; $base = array( trailingslashit(get_template_directory()), $my_templates );


1

The earliest safe hook to get post information is the template_redirect hook. All the hooks in question runs before Wordpress has setup postdata, so any post info are still unavailable at that point. The globals like $wp_query and $post will still contain no data, that is why your efforts returns nothing. EDIT Extra info as per comment by @TheDeadMedic ...


0

I think you mean shortcode rather than shortlink... There is a list of in-built shortcodes you can use in a page in the guide: http://www.designwall.com/guide/dw-question-answer-plugin/#shortcodes ...and of course you can always set your frontpage to be the page you have the desired shortcodes on...


0

If your plugin is not in the official wp plugin repository, than add a small function in your plugin, that exclude it from the update routine. It is not helpful that WordPress search for a update or this plugin. The source below helps you. Include it in your plugin to deactivate the update check for your custom plugin, in topic performance and redundancy ...


0

You've already been pointed to the correct approach and the answer is functionally identical to any of the answers here about appending data to post content. All you need is something like: function my_function () { echo 'my function content'; } add_action('the_content','my_function'); To restrict that to single post pages: function my_function () { ...


0

Do you need the "View Details" link? It shouldn't show up unless it's a WP hosted plugin. Could you just name the plugin whatever you want, but change it with JS in the admin function my_enqueue($hook) { if ( 'plugins.php' != $hook ) { return; } wp_enqueue_script( 'my_custom_script', plugin_dir_url( __FILE__ ) . 'changeName.js', array( 'jquery' ), '1', ...


2

You need to allow the content attribute of a meta tag to contain a shortcode, eg in your "functions.php" add: add_filter( 'wp_kses_allowed_html', function ( $allowedposttags, $context ) { if ( $context == 'post' ) { $allowedposttags['meta']['content'] = 1; } return $allowedposttags; }, 10, 2 ); and then your original (without the ...


2

register_activation_hook is one-time only activation hook. It can be used for database structure creation, as example, that needs to fire only on plugin activation trigger. In order to set a custom taxonomy you need a hook that will fire not just once, but per every WordPress load. Such as init. Use add_action( 'init', 'YOUR_CALLBACK' ); to achieve that


0

Jetpack's Post By Email feature uses your site's XML-RPC file to send data to your site, much like the Mobile Apps do whenever you post to your site from mobile. It is possible that your hosting provider limits the amount of calls that can be made to your site's XML-RPC file, or restricts POST requests to the XML-RPC file. I'd suggest that you contact your ...


0

for the idea of storing data on the provider webside, it's a good idea but I recommend to use JSON onstead of XML. it's a litte bit faster to parse and you will save a litte bit bandwith on the provider side, you can use the WordPress AJAX helpers to make somethig like that : add_action("wp_ajax_nopriv_logoData", function () { $data = array( ...


0

if the modification is called in the action admin_menu you can come just after, in order to correct the menu with some code like this : add_action("admin_menu", function () { $parent_file = 'parent.php'; $full_url = add_query_arg( 'action', 'action-name', admin_url( 'users.php' ) ); global $submenu; // searching the last submenu ...


0

I fixed this by going through PHPMyAdmin to the table "Options" and then the row active_plugins. I had the following stored there (formatted for readability): a:10:{ i:0;s:49:"1and1-wordpress-wizard/1and1-wordpress-wizard.php"; i:1;s:29:"acf-repeater/acf-repeater.php"; i:2;s:30:"advanced-custom-fields/acf.php"; ...


0

You can simply rename the plugin folder, for example: "_aksimet" to deactive it and than back to "aksimet" to activate it again (if was active) you can do that with all "plugins" folder together. Otherwise, go to MySQL and have a look at this step by step manual, in short: MYSQL > wp_options search for active_plugins entry (both steps can be done by ...


0

from Codex function add_theme_caps(){ global $pagenow; if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) ){ // Test if theme is activated // Theme is activated // gets the author role $role = get_role( 'author' ); // This only works, because it accesses the class instance. // would allow the author to edit others' posts for ...


0

in my case, it was simply the SITE URL left blank in Settings -> General Filled with mu site URL, everything started working again. i found out enabling WP_DEBUG in wp-config.php, and i got this error: "Notice: Undefined index: host"


0

Check for old or missing hidden files like .htaccess etc. These are prone to cause 500 Internal server error especially when not matching the installation.


0

By default the user can only edit their comments for the first 5 minutes. After that, the user is not able to edit their comment. If you want to change this time period, then this plugin allows you to do so using a filter. Simply add the following code in your theme’s functions.php file or in a site-specific plugin like this: add_filter( 'sce_comment_time', ...


0

Handling form fields is not related to WordPress and is off-topic here, BTW I'm answering this on how to use the options table. And your code you presented here is not relevant to your question. Ok, first of all having form data into a field after submission could put you in risk of entering duplicate entries. BTW here's how you can do that (follow the ...


0

I've since found my own solution: Delete the .htaccess file in the Wordpress root directory. I've written more details in a post on my blog at cellepo.com.


0

Also check that version of PHP in .htaccess is correct. You should see a line like that: AddHandler application/x-httpd-php55 .php (In this case it's for PHP 5.5) Note that you must do this at root of your WordPress site, not at root of your site.


0

The error of header already sent comes when your syntax is not correct. Just for info I am listing some situations where the message of unexpected output and headers already sent errors come! White spaces before beginning or end of PHP tags <php? and ?> undefined variables. writing HTML code outside the functions. commenting syntax errors. Any PHP ...


0

Enhance the native XML export - with a single day selection Here's one way to modify the native export with a select box, with all available days: Here we assume that there are not "huge" number of days to select from ;-) Otherwise we could use a different kind of user interface. Step #1 First we can add the HTML for our single day filter by using the ...


0

It is about creating custom hooks. The main ways is by using apply_filters() and do_action(). More detailed explanations is here https://developer.wordpress.org/plugins/hooks/creating-custom-hooks/


0

It's usually a temporarily error and is due to the server response. You can read more here.


0

It turned out to be one of the plugins that needed an update. It gave an error when i tried to disable it manually on the plugins section, but i uploaded a new version via FTP, the error went away.


0

Now in latest version of Woocommerce Subscription plugin, testing Subscription Renewal is more easy. Just follow these steps and you are done; Step 1. Purchase a Test Subscription If you have not already purchased a subscription to test, purchase a test subscription using the payment gateway you wish to test. After completing the purchase, take note of the ...


1

Prioritize your actions, so the register_style function runs first. (notice the third parameter in the add_action function) add_action( 'wp_enqueue_scripts', 'other_register_styles', 11 ); function other_register_styles() { wp_register_style( 'style', PATH . 'assets/css/style.min.css' ); wp_enqueue_style( 'style' ); // Working as expected ...


1

Probably nowhere because it outputs too early. I recommend to use error_log function and turn on WP_DEBUG_LOG. Just add to the wp-config.php file somewhere in front of this line: require_once(ABSPATH . 'wp-settings.php'); these new lines: define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); Now create in wp-content folder a new file debug.log ...


1

Pitta Migration Description Migrates the database wp_options to match WP_HOME and WP_SITEURL Type Plug & Play, no config needed beyond setting the WP_HOME and WP_SITEURL constants Download Link https://wordpress.org/plugins/pitta-migration/ Related Question How to: Easily Move a WordPress Install from Development to Production?


0

This tutorial on codetutsplus has everything you need to know. There is no need to use a plugin. Enqueuing them is pretty simple and is best practice. how to enqueue files in wordpress


0

Had a similar issue on my site, solved it by creating a single js file with all the scripts that were earlier in the header and footer.. this somehow solved the issue in the inner pages.. Also noticed that I was loading jQuery twice as well, removed the extra jquery file (Note: this did not solve the issue)..


0

First, always develop with debugging enabled. That white screen will now contain error messages to help you determine the problem. Refer to the action reference to see the order in which things happen during the load process. Your plugin is loaded before the plugins_loaded action, which is when your code runs. However, note that the current user isn't ...


0

Plugins run a lot earlier than themes - you need to delay the execution using a hook: /** * Fire once WordPress is ready and conditionally hook our handler. */ function wpse_199197_init() { $user = wp_get_current_user(); $allowed_roles = array( 'author' ); if ( array_intersect( $allowed_roles, $user->roles ) ) add_filter( ...


2

Plugins are loaded before the theme which means that your apply_filters won't have any actual callbacks registered to it. Instead, you need to call your apply_filters sometime after the theme has been loaded. Something like this: /* Your plugin's file: */ add_action( 'init', 'my_lovely_funky_filters' ); function my_lovely_funky_filters() { /* Fire our ...



Top 50 recent answers are included