I've created these two functions to toggle between the first paragraph of the content and then everything but the first paragraph so when the user selects 'More' it slides out the article smoothly without replacing the first paragraph that's already displayed as the excerpt. However if there's a shortcode in that text it shows up as the shortcode syntax rather than displaying properly. I understand why it's not displaying but I'd like to replace any shortcodes in the text so …
I have two taxonomies in use on my site, both of which have their own taxonomy archive templates with different interfaces. I use query strings to perform filtering on each of the archives. My problem is that if I use query strings on one taxonomy archive to filter by ANOTHER taxonomy, WordPress switches the taxonomy template. For example, let's say I have a car taxonomy and a color taxonomy. If I want to see all sports cars I use this …
I have code for custom post type, for custom taxonomy for displaying category posts. I am using Advanced Custom Fields What I want is to order posts by custom field value, and I was wondering how I can do it? For example if posts have custom field called “rating” how can I order posts from lowest value to highest? Here's an example code <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'brendovi' ) ); ?> <?php if (have_posts()): query_posts($query_string.'&posts_per_page=-1&orderby=date&order=ASC'); …
I have seen various ways to schedule the WordPress cron so that it is triggered by the server. Some will run the php file directory from the crontab and others will use a wget and reference the url. I have noticed some sites suggesting this: wget -q -O - https://domain.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1 What is the difference between this and just using wget -q -O - https://domain.com/wp-cron.php >/dev/null 2>&1
I'm trying (and failing) to use rewrite rules to redirect shorter/prettier URLs to the right page AND include values in the query string. WP is installed at https://example.com, and the plugin creates a page called 'foo' which uses a value 'bar' passed in the query string to generate the content from custom database tables. So an example full URL would be: https://example.com/foo/?bar=XXXXXX The 'bar' value would always be a string of between 6 and 8 alphanumeric chars with at least …
I don't know how to turn some WP QUERY parameters into url query strings. Most of them are straight forward, but there are some I don't know how to get working. For example, for these WP_QUERY parameters: $args = array( 'post_type' => 'post', 's' => 'keyword', ); the query string for this is: ?s=keyword&post_type=post What is the query string for the 'after' parameter with value '24 hours ago'. For example, this WP_QUERY gets posts created in the last 24 hours: …
Been trying to figure out a good method to change the browser tab/window title for a backend admin page for a plugin. I've tried a slew of plugins, including Admin Meu Editor Pro, and for whatever reason, it's just not sticking. Can anybody help? Here is a code I tried out: add_filter( 'gettext', 'wpi_translate_words_array' ); add_filter( 'ngettext', 'wpi_translate_words_array' ); function wpi_translate_words_array( $translated ) { $words = array( // 'word to translate' = > 'translation' 'Plugin Name' => 'Change for Browser …
I am trying to remove the query string from my URLs when I redirect them but it is preserving them. I can't get the regex right. Also, I have multiple templates that redirect to different urls so I can't just use .* after howto.php .htaccess is not an option in this case so I must figure out how to do this in the Redirection plugin I want /templates/howto.php?page=template-business-plan to go to /business-plan but i keep getting /business-plan?page=template-business-plan
I have created a store/franchise locator page here. Once users click "Contact Franchise" on the locator, the franchise name is passed to the form underneath. The query string looks like this webpage/?selected-franchise=Franchise%20Name When I add the anchor to the form (webpage/?selected-franchise=Franchise%20Name#form), it works when you are coming from another page/open in a new window but when clicked on while on the same page, the page anchors down but does not refresh and pass on the Franchise name to the first …
I've written a quick little plugin to grab some custom query_vars, do some manipulation, and store the output in a CSV file. It works great for pages and posts, but ... it seems that queries to wp-content/uploads don't actually go through WordPress, and I want to grab those, too. I'm thinking of two different approaches: per the answer to this question, maybe write a custom rewrite rule, and pass the request into WordPress iff it's a query for wp-content/uploads and …
Currently, I'm working on a search application that searches/filters stores(Custom Post Type) based on the store-feature(Custom Taxamonies) IDs. When I use the WordPress Fetch API, I can get the full set of Custom Post Type data without any problems. The issue is the query string I've been trying to build. I'm essentially trying to make the query string filter by an AND instead of an OR. Example: Store One store-features: 55 AND 96 Store Two store-features: 55 Store Three store-features: …
I am trying to get a custom URL parameter from a URL in WordPress. I add the following code to functions.php: function add_query_vars_filter( $vars ){ $vars[] = "token"; return $vars; } add_filter( 'query_vars', 'add_query_vars_filter' ); Then on the webpage I write: <?php $token = get_query_var( 'token', $default = ''); ?> <h1>Currently Browsing token <?php echo (int) $token; ?> On a static front page</h1> and go to the webpage http://www.negovista.com/tokensuccess/?token=xxxxxx However on the page is only printed 'Currently Browsing token On …
My WordPress site also incorporates some external non-WP content that is dynamically pulled into the page via shortcode. The content shown depends on a query string parameter. So from WP's point of view, index is just a single page containing a shortcode; but in reality, when you visit index?x=1, index?x=2, index?x=3, etc. you get different page content depending on the x value. (It's a primary key ID into a large external database.) This works fine, and avoids creating thousands of …
I have an issue with passing an array of strings to a SQL statement in a WordPress plugin, because the prepare method adds a backslash before each apostrophe. // I have an array of strings. $the_array = ['red', 'green', 'blue']; // I convert the array into a single string containing comma separated values surrounded by apostrophes. $the_string = "'" . implode("', '", $the_array) . "'"; // And I pass the string to the query, using prepare (necessary to avoid SQL …
I’m trying to auto-populate a form using url parameters (query strings). The problem is when I use the “name” query string (eg mysite.com/?name=xyz), it is referring to the pagename instead of the Name form field and showing a 404 error. For eg, if I type mysite.com/?name=david, it shows 404 but if I type mysite.com/?name=about it goes to mysite.com/about. To try and override this on the page where I have the form, I tried the following code: function del_name ($qvar) { …
In the Wordpress Admin 'Reading Settings' under the 'Your home page displays' option, when a static page is selected as Homepage, it appears that any query string with special characters added to the URL of the base site becomes encoded. Using an example URL, if the option was set to 'Your latest posts', I get a 200 status code with the following URL http://my-wordpress-site.com/?query=1:2:3 However when I choose the 'Home' page to be the Homepage, and enter the same address, …
I'm using the WooCommerce REST API to search products by string. Quick question: Is it possible to limit the REST API query ?search= to products names ? Currently it also searches the string in the descriptions.
I created simple custom WordPress plugin for a client in 2016 that simply displays a paginated list of results queried from a custom table. try { $recordcountquery = 'SELECT FName,LName FROM tblBurialRegister WHERE'; if (!empty($_SESSION['firstname'])) { $cond = $mydb->prepare(' FName = %s', $_SESSION['firstname']); $recordcountquery .= $cond; } if (!empty($_SESSION['lastname']) && !empty($_SESSION['firstname'])) { $recordcountquery .= ' and'; } if (!empty($_SESSION['lastname'])) { $cond = $mydb->prepare(' LName = %s', $_SESSION['lastname']); $recordcountquery .= $cond; } $countresults = $mydb->get_results($recordcountquery); $total = count($countresults); // How many …
I am looking to replace a few text strings for only two specific pages on a wordpress site. It should not affect those strings on any other pages. I'd prefer to do this via adding some code to functions.php I think using part of this code would be the first part, just need help with the rest https://wordpress.stackexchange.com/a/278357
It seems as though all WordPress sites that I’m supporting for various clients has this same functionality — if the site is using a static homepage, and you visit the homepage with a query string containing + signs — the page is redirected (301) and the plus signs are turned into %20 — Interior pages and posts do NOT suffer this same effect. For example (I am not supporting this site, just using it as an example): https://wpengine.com/?test=test+test (redirect occurs) …