Tag Info

New answers tagged

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', ...


0

In order to change comment_form label, according to comment_form() WordPress Codex, you simply need to pass an array with parameter: label_submit (string) (optional) the name of submit button. Default: __( 'Post Comment' ) In you case, change <?php comment_form( array( 'label_submit' => 'Submit Comment' ) ); ?> To: <?php comment_form( ...


1

I wanted to achieve the same thing.. What I ended up doing was creating a function that collects the Kirki variables (see here about the use of variables in Kirki) and writes them to a scss.. $file = get_template_directory() . '/sass/custom/_custom_vars_mixins_options.scss'; if(file_exists($file)){ $output = ""; $variables = ...


0

try get_pages with 'child_of' => get_the_ID(), 'parent' => get_the_ID(), If you need i can post full code EDIT : if ( is_singular('post') ) { $args = array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'post_status' => null, 'parent' => $post->ID , 'child_of' => $post->ID, ...


0

Long story short, build a new array with the categories indexed by ID. Then you can just loop over the date-sorted IDs and do with them as you wish: $categories = get_categories(); $cats_index = $cats_dates = array(); foreach( $categories as $category ) { // Index the categories by their ID $cats_index[ $category->term_id ] = $category; ...


1

How can I make this code to display the meta tags at the top of the header section right after ? You probably can't. Typically wp_head() is called at the end of the </head> section, but that is theme dependent. You don't have any control. How can I put each meta tag on a separate line? Use double quotes and \n... $cjt = '<meta ...


0

usort uses a callback function to sort an array: $categories_order = array_flip($categories_order); $categories = usort( get_categories(), function( $a, $b ) { return $categories_order( $a['term_id'] ) - $categories_order( $b['term_id'] ); }


0

just use the function get_avatar, $default is for your custom default. <?php echo get_avatar( $id_or_email, $size, $default, $alt, $args ); ?> https://codex.wordpress.org/Function_Reference/get_avatar


0

This solution is based on a couple of WPMU Dev plugins: PopUp Pro and Mailchimp Integration. If you are WPMU Dev member then download and install them either from their Project pages or via the WPMU Dev dashboard in your WordPress admin interface. Most of the effort is in creating a custom style for the popup. The Mailchimp Integration plugin simply provides ...


2

max_input_vars is the limit on the total number of GET, POST, and COOKIE vars. To determine how many there are you can just count them. Here's a quick example in a WordPress context: function wpd_admin_error_notice() { echo 'This request contained ' . count( $_POST ) . ' POST vars, ' . count( $_GET ) . ' GET vars, and ' . count( $_COOKIE ) . ' ...


1

Before all of that, I would recommend trying Image Rotation Repair plugin.


0

Try this.... <?php $string = get_field('first_name'); echo $string[0]; ?> I am not that much familiar with ACF. But my answer is based on their function reference here http://www.advancedcustomfields.com/resources/the_field/ Hope this helps. Sabbir H


0

You can simply add those CSS to admin HEAD section, it's fast and easy solution. function jrl_styles() { ?><style type="text/css"> #jrl-wrap { width: 700px; padding: 3em; /* ... */ } </style><?php } add_action('admin_head', 'jrl_styles'); Or you can enque your CSS file like this: function ...


0

The answer is simple: do not use sanitize_html_class. Take the input as it is (you can still do basic validation like length, making sure it is an integer only etc) and if you need to output that on the front and you don't trust the user who stored the data either use something like esc_html or wp_strip_all_tags depending on your needs. Of course, you can ...


0

Here is how I got it to where I wanted it: Change $class = "span".($k < 2 ? 6 : 12/(count($members)-2)); to $class = "span".($k < 0 ? 6 : 12/(count($members)-2)); and remove this section completely: ($k === 2 ? '<div class="clearboth"></div>' : ''), I am sure there are other (better?) ways of getting to the same result but this is the way ...


0

Use the Co-Authors Plus to assign the authors and the post will show automatically on both author pages. I've used it and works pretty well.


0

Since it's a standalone script, you can just link to it directly and WordPress will be none the wiser. Just make sure you get the link right - if it's in your theme, it will be something like: http://example.com/wp-content/themes/my-theme/generate-pdf.php Don't hardcode the URL though, use the available template functions: <a href="<?php bloginfo( ...


0

You can use the template functions given by Co-Authors Plus plugin such as, coauthors_posts_links() - Co-Authors Plus equivalent of the_author_posts_link() template tag. coauthors() - Co-Authors Plus equivalent of the_author() template tag. Please refer to their documentation


0

For this purpose there is get_term_link function (documentation). <a href="<?php echo get_term_link( 42 ,'product_cat') ?>">Fine Art ... etc.</a> Product category is just WP taxonomy, so there is plenty of functions to work with. In this case you have to know your product category ID (taxonomy term ID, actually). When editing category, ...


0

I have added the style "background-position: center center;" and it work perfectly! So the new code will look like this: <?php global $post; $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, '' ); ?> <div class="mainblogwrapper" style="background-image: url(<?php echo $src[0]; ?> ) ...


0

OK perfect. There was a syntax error in this line: <?php if( 1 == $blog_id ); ?> replaced: <?php if( 1 == $blog_id ): ?> close post.


0

I have write : <?php $blog_id = get_current_blog_id(); ?> <?php if( 1 == $blog_id ); ?> <div id=""><script src=""></script><script src="" ></script></div> <?php elseif( 2 == $blog_id ): ?> <div id=""><script src=""></script><script src="" ></script></div> ...


1

You can check for specific user role using following code - if (is_user_logged_in() && current_user_can('administrator')) {} The function current_user_can() takes role name as parameter. For more info - https://codex.wordpress.org/Function_Reference/current_user_can/


0

You can make WordPress query for a certain user role by using current_user_can("role_name"). Thanks to Mayeenul Islam for providing the solution!


0

At first glance, you're assigning values to get_current_blog_id instead of comparing them. That is get_current_blog_id() = 1 should be get_current_blog_id() === 1 in both places.


0

Yes, you can include a check for is_home() or is_front_page() and return a different title based on that. Update: TwentyEleven does it like this for example (lines 27 to 45).


0

You are getting that because the $post variable isn't set. You'll need to call global $post at the beginning of your function. function custom_content_filter_the_content( $content ) { global $post; ...


0

I ran into this today and couldn't find any good answers anywhere, so I wanted to comment somewhere at least. For mine, it ended up being the home/siteurl values in the database. After I updated those, I was able to edit users again and log in properly. I'm sure there are other causes, but that's a nice simple possibility to check.


0

also this is my class file content: <?php class Contact_Widget extends WP_Widget{ /* * Plugin Constructor */ function __construct() { parent::__construct( 'contact_widget', // Base ID __( 'Ajax Contact Widget', 'text_domain' ), // Name array( 'description' => __( 'Ajax powered contact widget', ...


0

this is my plugin content: <?php /** * Plugin Name: Ajax Contact Widget * Plugin URI: http://aliqorbani.com/plugins/contact-widget * Description: just a simple contact widget plugin. * Version: 1.0 * Author: Ali Qorbani * Author URI: http://www.aliqorbani.com * License: GPL2 */ /* * include JS */ function add_scripts(){ ...


0

I have been working with a plugin called TM Extra Product Options and I am fairly sure you could achieve your goals using that. It isn't the prettiest plugin from a UI perspective, but it has a lot of functionality and good support if you use their forums. You could use a select box for number of characters and then set a conditional field to appear when ...


0

var selectedValue=$(this).children(":selected").val(); Use this for getting value for select tag


0

As per the ACF documentation, you must pass either the term and term ID or the term object to the get_fields() function for a taxonomy. So in your case, you would replace $tag_image = get_field('tag_image'); with: $tag_image = get_field('tag_image', $term);


1

WordPress 4.2.3 made some changes to the way shortcodes work in order to fix a security issue. See here: https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/ This is most likely the cause of your problem. See the Shortcodes with Bad Quotes section, and the accompanying workaround suggestion.


0

Okay I hate it when I just figure it out after I post the question. But it seems each post can have a number of attachments. Which means each attachment has an ID associated with it. Which was confusing because it shared the same ID style and type as the post. The following code is able to get the URL of the associated uploaded image $media = ...


0

Here is one approach: $myrows = $wpdb->get_results( "SELECT first_name, surname, role, email, country, bio FROM members" ); foreach ( $myrows as $row ) { $first_name = $row->first_name; if ( ! empty( $row->bio ) ) { $first_name = '<a href="#">' . $first_name . '</a><div class="bio" style="display: none;">' . ...


0

I managed to resolve this problem with changing Apache server configuration: there is a KeepAlive flag which needs to be turned Off. More about this flag: Apache Optimization: KeepAlive On or Off?


1

Add the filter "ajax_query_attachments_args" in this way and URLs variables are sent to the class WP_Query the default is to send array(7) { ["orderby"]=> string(4) "date" ["order"]=> string(4) "DESC" ["posts_per_page"]=> string(2) "40" ["paged"]=> string(1) "1" ["post_type"]=> string(10) ...


2

You can adjust the attachment query in the media library popup, through the ajax_query_attachments_args filter. Here are two PHP 5.4+ examples: Example #1: Show only attachments that where uploaded during the last 24 hours: /** * Media Library popup * - Only display attachments uploaded during the last 24 hours: */ add_filter( ...


0

I ran into the same problem and tried doing a google search and came up with so many technical suggestions that I could not begin to even start as I'm not tech savvy. I did run into an article where a blogger said she contacted her hosting server and they changed the PHP version. It may or may not work for me but I was going to try. Only I didn't know how ...


0

I have posted an answer so this is more concise but have marked the helpful answer as accepted. The initial issue was as @Kevin Fodness pointed out, the browser failing to see the The strange character in the I opened them in vi. Then a massive chunk of exploit was visible. I'm guessing that the behaviour above (UPDATE 4) was because the exploit didn't ...


0

my pleasure to help you. I will give suggestions until we find the right solution. I suggest that you: - add a custom product attribute to use for variations - set a name of your choice and values likes this [ One-Five |Six| Seven | Eight|Nine| Ten ] so you can set prices to them - add an input text field on the front end with a fixed number of caracters ...


1

First of all, you are using $rinter as a number and at the same time as an URL for the anchor element. Secondly, the href attribute requires mentioning the protocol (http(s):// for example) in front of the domain or else it will just be relative to the current viewing address. ($rinter should be something like http://www.w3.org instead of just www.w3.org)


0

$word_product = $_GET['username']; $word_price = ""; $word_lenght = count( $word_product ); if ( $word_lenght <11 ) { if ( $word_lenght>= 0 && $word_lenght <=5 ){ $word_price = x ; }else { if( $word_lenght >5 ){ $word_price = x + ( $word_lenght-5 ) * y ; } } } Try out this algorithm


0

I figured it out! I had too many parameters trying to match and had to replace "[^/]+" with "(.+?)" i was able to get this with just one rewrite rule here is the final code: add_rewrite_rule( 'resources/(.+?)(/page/([0-9]+))?/?$', 'index.php?taxonomy=res_category&term=$matches[1]&paged=$matches[3]', 'top'); now the problem i have now i get a 404 ...


0

At first blush, your code looks solid. Two suggestions: 1) Try putting the longer rewrite rule before the shorter one. It's possible that the first one is being matched (because it is a subset of the longer one) and then not proceeding to check the longer one. 2) Whenever you modify rewrite rules, you have to flush and reload the rewrite rules for them to ...


0

I think this is the browser modifying the DOM due to a weird character you have in your body tag. When I view source in Firefox, I'm seeing the "character not recognized" box next to the body tag. This is also visible in Firefox inspector. Modern browsers automatically fix issues in your HTML for you when rendering the page. For example, if you have a ...


0

Have just tweaked your code to achieve what you need. See, if this works for you - $taxonomyName = "age"; $parent_terms = get_terms($taxonomyName, array('parent' => 0, 'orderby' => 'slug', 'hide_empty' => false)); echo '<ul>'; foreach ($parent_terms as $pterm) { $terms = get_terms($taxonomyName, array('parent' => $pterm->term_id, ...


0

There are multiple plugins to manage and serve ads on your WordPress website. I don’t know the Reddit system, but here are three solutions I have seen used by clients who let advertisers purchase ad space directly. Simple Ads Manager – like it, but not always trustworthy in the latest updates AdRotate - ok for most self-serving setups OIO Publisher – ...


1

For me the problem would be to use a plugin that uses evil() eval() to evaluate string as PHP, in the first place ;-) This part is from the PHP manual: Caution The eval() language construct is very dangerous because it allows execution of arbitrary PHP code. Its use thus is discouraged. If you have carefully verified that there is no other option ...



Top 50 recent answers are included