Tag Info

New answers tagged

0

i didn't want to use js, i wanted a php solution, plus i also manipulate all internal links into anchor links. in the end, you have to decide for yourself, what would be the best way for you, php or js. this goes into functions.php inside the current theme folder. add_filter('the_content', 'crawl_content'); function crawl_content( $text ) { $url = ...


0

You could try using the terms_clauses filter function wpse156370_terms_clauses( $pieces, $taxonomies, $args ) { global $wpdb; $pieces['fields'] .= $wpdb->prepare( ', (SELECT COUNT(*) FROM ' . $wpdb->posts . ' p, ' . $wpdb->term_relationships . ' p_tr' . ' WHERE p_tr.object_id = p.ID AND p_tr.term_taxonomy_id = ...


0

The only way to do it is using a query filter I think function wpse156319_posts_where( $where, $query ) { global $wpdb; $where .= $wpdb->prepare( ' AND (' . $wpdb->posts . '.post_parent = %s OR ' . $wpdb->posts . '.post_author = %s)', $_POST['id'], get_current_user_id() ); return $where; } which you just add in the ...


0

This looks like it would get you pointed in the right direction: http://stackoverflow.com/questions/6215797/wordpress-post-id-in-wp-nav-menu


0

You can do this in jquery on document load. Using addClass $("#DivName").find("a").addClass("YourClassHere");


0

I doubt that ever worked by itself. WP_Query operates on posts database table. On the bottom SQL level to make use of post metadata you need to not only say what metadata you are looking for, but also instruct MySQL how metadata table connects to your posts table (JOIN realm). I would attempt to keep manipulating query arguments for starters, it doesn't ...


0

While there is no hook, there is a small workaround that makes your end-goal possible. You can create a new shortcode that, on a per-instance basis, you always wrap around any other shortcode whose output you want to filter. Usage in a post, etc: Here is some post text. Blah blah... [filter][target_annoying_shortcode size="small" limit="20"][/filter] Here ...


1

I always thought that the memory size was the limit for the string length, but according to the PHP documentation: string can be as large as up to 2GB (2147483647 bytes maximum) There is also the maximum allowed memory size (memory_limit) for the PHP script, to consider. Testing: Do not perform this on a production server: You could always use the ...


1

The $tag is used as a key in an array, so it is converted to either a string or an integer. There is no maximum size for strings, the available memory is the only real restriction. The size of an integer depends on the platform: The size of an integer is platform-dependent, although a maximum value of about two billion is the usual value (that's 32 bits ...


0

The filter works when placed in active theme's functions.php file. Just tested that, and the result was positive.


0

In general they should. All of config load, plugins load, and theme load happens during load process and before init hook, which is considered a point after which load is done and functionality starts. Unless you are dealing with early load-related events, typically plugin is perfectly appropriate place. PS not sure what you mean by config.php, hooks don't ...


0

Your problem is not as much filtering content, as content assuming too much about context and doing things that content shouldn't really. You don't read the book where text decides to color itself, it's decided for it. I would suggest to consider decoupling content from active context-specific functionality. You can still use shortcodes, but instead of them ...


0

you did not describe what you edited to add the isotope filtering, but you seem to have removed post_class() from this line to add your isotope class: <article class="<?php echo $termsString; ?>item"> change it to: <article <?php post_class( $termstring . 'item' ); ?>"> http://codex.wordpress.org/Function_Reference/post_class


0

If you're looking to use this with Custom Posts, replace where it says post in the if statement with the slug of your post type. With Custom Taxonomies, replace where it says #category-all with the name of your taxonomy (e.g., #taxonomyname-all). Your situation will most likely be both if you are looking at this. For multiple taxonomies/post types at the ...


1

The way you do it is fine. Also have a look at how Tom McFarlins WordPress Plugin Boilerplate does it: if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) { require_once( plugin_dir_path( __FILE__ ) . 'admin/class-plugin-name-admin.php' ); add_action( 'plugins_loaded', array( 'Plugin_Name_Admin', 'get_instance' ) ); ...


0

Now with the new information I would go with this: ?> <form method="post" action="where_ever_you_want_to_point_the_user_afterwards.php"> /* The loop: */ if (the_field('departures') == 'user_departure_location') { <input type="radio" name="destination" value="<?php echo the_field('destination'); ?>"> <a href="<?php ...


1

This is a required field (http://codex.wordpress.org/Function_Reference/wp_create_user) and I think that more than one function in the core of Wordpress relies on that. So I would not recommend to code around it or alter any other WP core files as the next update could render all these changes back to the default values.


0

As brasofilo mentioned you can do a str_replace() on the admin_post_thumbnail_html filter. function changeFeaturedImageLinks($content) { $content = str_replace(__('Set featured image'), __('YOUR_CUSTOM_TEXT'), $content); $content = str_replace(__('Remove featured image'), __('YOUR_CUSTOM_TEXT'), $content); return $content; } ...


0

wp_login action is available. The wp_login action hook is triggered when a user logs in by the wp_signon() function. It is the very last action taken in the function, immediately following the wp_set_auth_cookie() call. Check this official documentation.


0

There are essentially three criteria here: do images belong to the site (are WP attachments) are images attached to this post are images used in this post This has side effects, like: images used in post are not necessarily attachments post's attachments aren't necessarily used in that post So the only reliable way to produce complete set of images, ...


0

You can use the get_attached_media(), function. I have linked the above to the Codex. P.S This is not my own code, straight from the WordPress Codex: <ul> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' ...


0

Parsing of the requested URL happens in the file wp-includes/class-wp.php. The magic happens starting at line 148 in the parse_request function. For path info style permalinks, $_SERVER['PATH_INFO'] is used, for pretty permalinks, $_SERVER['REQUEST_URI'] is used.


0

I will expand my question with more information for better understanding. At the /testting/ folder (the blog's directory). The basic .htaccess shows: RewriteBase /testting/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /testting/index.php [L] Once ...


0

First thing is you are returning jQuery through PHP without script tag, so you should at the least be using this: add_filter('the_content', 'my_drama_func'); function my_drama_func () { return "<script>function getthrough() { jQuery.ajax({ url: 'ajax/ajax.php', type: 'POST', data: ...


0

You can use a image_send_to_editor filter hook to achieve what you want. <?php add_filter( 'image_send_to_editor', 'imagehtmlchange', 10, 8); function imagehtmlchange($html, $id, $caption, $title, $align, $url, $size, $alt) { // your banny wrote - put your code here return $html; } ?>


0

If i understand right what you're looking for is get_query_var( $var ) which return the given var passed trough the rewrite process. http://codex.wordpress.org/Function_Reference/get_query_var Here a list of WordPress Query Vars http://codex.wordpress.org/WordPress_Query_Vars For debugging purpose you can get a list of all the query_vars using: global ...


0

In your funtions file, you need to create your function, name it as you like: function my_changein_args ($my_form_args) { return array( 'echo' => true, 'redirect' => esc_url( apply_filters( 'sidebar_login_widget_login_redirect', $redirect ) ), 'label_username' => __( 'Yourusernamelabel', 'sidebar-login' ), ...


2

If this is only for certain content areas, create your own filter, and base it off the original the_content filter. Put this in your functions.php (found in wp-includes/default-filters.php) add_filter( 'se152488_the_content', 'wptexturize' ); add_filter( 'se152488_the_content', 'convert_smilies' ); add_filter( 'se152488_the_content', ...



Top 50 recent answers are included