hi i want to display posts by term. first the code display all the posts: $aProjectArgs = array( 'post_type' => 'uni_project', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'asc' ); so i add another part of code to display posts by term: $aProjectArgs = array( 'post_type' => 'uni_project', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'asc' 'tax_query' => array( array( 'taxonomy' => 'post_tag', 'field' => 'id', 'terms' => 43 ) ) ); but its not working its give …
I'm migrating from one Visual Page editor to another. I'm extracting the texts surrounded by the shortcode opening and closing tags. Before I write my own parsing script, I wanted to make sure that Wordpress didn't already have a solution for this, or something else didn't already exist either. I feel like this is a common need that there may already be something to handle it. Here is an example of the post_content data. As you can see this can …
What is the best way to analyze existing site fully built on Gutenberg Blocks and inspect intersection of existing blocks structure and it’s inner blocks combination for all pages? Context: Imagine that instance have: ~100 landing pages and СPTs(not just blog posts) that built using core block, custom and some vendor blocks. each page using about 150 blocks (according on Query Monitor -> Blocks counter) no components at all: there are a huge blocks fragmentation in components/layouts, like you are …
I am looking for a way to tweak my xml parser code to insert a url from an external source into a new post, instead of first uploading it to the website's media library and than adding the attachment. I have been looking for answers for the past week. But every time I google it, the search results come down to someone asking how to upload a attachment to a post, which I already have fixed. But I did see …
What's the meaning of "Parses the request to find the correct WordPress query" in plain Englush? Reference: https://developer.wordpress.org/reference/classes/wp/parse_request/ I encountered this function while trying to edit a PayPal gateway plugin as below. /** * Parse request to find correct WordPress query. * * @since 1.6.4 * @param WP_Query $wp WordPress Query object. */ public function parse_request( $wp ) { if ( array_key_exists( 'acadp_action', $wp->query_vars ) && 'paypal-ipn' == $wp->query_vars['acadp_action'] && array_key_exists( 'acadp_order', $wp->query_vars ) ) { $this->process_payment_ipn( $wp->query_vars['acadp_order'] ); exit(); …
As widgets are outside post content, i couldn't find the way to parse blocks inserted inside widget area for ex. "sidebar-1" We use something like below for parsing post contents, $post = get_post('100'); parse_blocks($post->post_content) But for widgets, i couldn't do it like below, ob_start(); dynamic_sidebar('sidebar-1'); $widget_content = ob_get_clean(); parse_blocks($widget_content)
I would like to manipulate Gutenberg Blocks with PHP. Therefore I need to parse post_content into an array and the same way back after manipulation. But I don't get that far, because already the parsing back and forth doesn't work. function change_post_data_before_save( $data, $postarr ) { $post_data = $data['post_content']; //post_content seems to be json encoded //stripping slashes otherwise $blocks[0]['attrs'] would be NULL $post_data = str_replace('\\"', '"', $post_data); //trying to replace double slash in unicodes but it seems not to work …
So I have just installed wordpress on shared hosting (with php 8.0 & DB (I forgot what version but it works) and immediately after setup, I get this: Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /home/wwwroot/hkc01210429205315/wp-includes/functions.php on line 1090 So like what is going on? This seems to only happen some of the times that I visit the site (7/10) and other times it shows up just fine. Like, WTF? Here is functions.php line 1090: …
I'm seeking to echo the domain name (url) without the 'http://' (or 'https://'). I've created the following: <?php $surl = bloginfo('url'); $findh = array( 'http://' ); $replace = ''; $outputh = str_replace( $findh, $replace, $surl ); echo $outputh; ?> also another one (of many) I tried: <?php $surl = bloginfo('url'); echo str_replace('http://', '', $surl); ?> Seems like a simple task, but output still includes the 'http://' when the domain is echo'd. Reviewed other posts here and other sites to no …
I need to know if the first block is an image and if it's aligned right or left. I printed the $first_block_attrs variable and can see the output is Array ( [align] => center [id] => 450 [sizeSlug] => large [linkDestination] => none ) but am not sure how to check if the [align] attribute is either 'left' or 'right'. Or how to check if it is not 'center' or even unset. Any help is appreciated! if ( has_blocks( $post->post_content …
I have created this shortcode and registered it: function product_paypal_button_display($atts){ //Make the PayPal variables available downstream. global $wpdb; global $product_paypal_sandbox_url; global $product_paypal_live_url; global $product_paypal_sandbox_merchant_id; global $product_paypal_live_merchant_id; //Get post id for auction from post where auction is inserted. Used in SQL queries to find bids, id's buy status for painting and id's the painting in the PayPal button url params and returned Instant Payment Notification. $product_postid = get_the_id(); //Creates djw_products table in database if it doesn't exist. $table = $wpdb->prefix . …
I think either I am quite stupid today or just work-blind by this project but I've been trying to fix a little error a new shortcode is causing. This is the code <?php function reviewslide_function() { $output .= ' <!-- Review Injection --> <div id="reviews" class="p-full"> <div class="section_head"> <span class="eyebrow">You about us</span> <h2>Customer Reviews</h2> </div> <div class="stars"> <span class="material-icons">grade</span> <span class="material-icons">grade</span> <span class="material-icons">grade</span> <span class="material-icons">grade</span> <span class="material-icons">grade</span> </div> <div id="reviewbox">'; $args = array( 'post_type' => 'review', 'posts_per_page' => 5, 'order' …
I have a URL provided by my Real Estate service that lists, in a XML file, every apartment and house that I have to sell. The XML url lists every detail of every apartment, things like images, year of building, floor, prices, rent, etc. I need to create a Real Estate WordPress website where I can list, from this url, all those apartments and house and also show a filter where I can filter apartaments by price, by location, etc. …
Coming from a Perl background (no snickering) and trying to make sense of some new conventions. Not sure whether this is a PHP, WordPress, or Ninja forms question. $form_data //Ninja parlance contains: ["value"] => string(8) "John Smith" ["key"]=> string(33) "first_and_last_name_1570130204042" So when I test for a key, it's seeing: string(33) "first_and_last_name_1570130204042" Of course, I'm not interested in string(33) but in it's 'name' (not sure what it's called) first_and_last_name_1570130204042 How do I get, in essence: $form_data['key'] = "first_and_last_name_1570130204042" without a lot …
I am trying to store my render post table HTML data of just the table into a PHP variable after the table is completely loaded. I've tried to store: $table = new Custom_Table_Example_List_Table(); $tablehtml = $table->display(); But this returns an array, not the full rendered table.. (e.g <table>...</table>). I have tried using JS var table = $(#tableid").html and with document.write to fire, but keeps coming back as undefined. But if I tie it to a click action of a button, …
I am trying to separate Custom ACF Gutenberg Blocks from the rest of the core blocks on a post. Currently I am using the_content(); This is grabbing every block in the Gutenberg Editor. What I want to do now is look at all the blocks in the Gutenberg editor, check to see if they are a custom ACF block, and if they are an ACF block then output them else, don't output the block. What I have currently is: $blocks …
How to parse any content which was added after the working out filter 'the_content'? For example I have html structure of the simple page that i was created via Worpdress Admin Dashboard -> Pages -> Add New Page: <div id="content" class="site-content"> <div class="wrap"> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <article id="post-20" class="post-20 page type-page status-publish hentry"> <header class="entry-header"> <h1 class="entry-title">Some page</h1> <span class="edit-link"> <a class="post-edit-link" href="http://wp.loc/wp-admin/post.php?post=20&amp;action=edit">Edit <span class="screen-reader-text"> "Some page"</span> </a> </span> </header><!-- .entry-header --> <div class="entry-content"> </div><!-- .entry-content …
I am writing a plugin where I need to split a URL submitted to a form into all the component parts of the URL including subdomain, extension etc. In addition, I need to construct the relative address for the URL submitted. I know about the Wordpress function wp_parse_url() but as per the example in the developer documentation, if I submit the URL https://developer.wordpress.org/reference/functions/wp_parse_url/ I only get some of the information that I need namely: array ( 'scheme' => 'https', 'host' …
I'm not a programmer, but now I have a problem with my Wordpress-Site, which I can't figure by my self. I have a white screen and can't look into my wordpress-site. After I activated the Debug-Mode, it shows the following error: Parse error: syntax error, unexpected '$q74ed' (T_VARIABLE) in /***/wp-includes/functions.wp-scripts.php on line 1 I looked into the code, but I can't say whats wrong with this one. Maybe you can help me? Otherwise I have to reinstall wordpress, I guess?! …
Nginx 1.10.3, WordPress 4.9.1, Elementor 1.8.11. A subdomain site. The problem Global fonts appear fine inside Elementor view but not outside of it. That is to say: When you click "Edit this page with Elementor" global fonts like Assistant for headings or Open Sans Hebrew for general text appear fine but the moment you quit, all the site is in Arial. Here's what I did trying to solve it: Unselecting the option that disables Elementor global fonts, and saving the …