Website Search Results Not Showing Images

Look here: if($row->type==’post’){ $result = wp_get_attachment_image_src ($attachment_id, ‘medium’); $url_img = $result[‘url’]; $permalink = get_permalink($row->id); } You are using attachment_id variable, but you have not initiated it anywhere. if($row->type==’post’){ $attachment_id = get_post_thumbnail_id($row->id); $result = wp_get_attachment_image_src ($attachment_id, ‘medium’); $url_img = $result[‘url’]; $permalink = get_permalink($row->id); }

WP CF7 custom var

Make sure you’ve read the shortcode API. A shortcode must be a callback (i.e. a function), not a value. And add_shortcode only works for the shortcode name, not an attribute: dynamichidden is the name of the shortcode, and CF7_custom_prod_code is an attribute. You won’t be able to hook into it using add_shortcode( ‘CF7_custom_prod_code’ ). You … Read more

Install WordPress using PHP

Please check if PHP is running in safe mode. excel_shell is disabled when PHP is running in safe mode. You can check this running the phpinfo() function. Tip: You could make a install script in bash and execute that from PHP. This way it’s easier to test on the command line first, and then wrap … Read more

Add product to cart from functions.php

I’ve figured it out function my_custom_function() { global $woocommerce; if ( $_SERVER[‘REQUEST_URI’] == ‘/checkout/?a=b’ ) { $woocommerce->cart->add_to_cart( 90759, 1 ); // exit; } } add_action( ‘init’, ‘my_custom_function’, 7 );

WordPress doesn’t recognise my email address and I’m missing the wp-config file in PHPmyadmin cPanel to make alterations

Google authentication sounds like the least of your worries. wp-config.php lives in the public_html folder of your website, not in SQL database. Assuming everything else is configured correctly, then you will simply need to put your SQL info into wp-config.php and then go to your main website url via the browser       If … Read more

How to pull and auto display custom fields values to contact form

May be try like this: foreach( $post_ids->posts as $id): // get the post title, and apply any filters which plugins may have added // (get_the_title returns unfiltered value) $name[] = apply_filters(‘the_title’, get_the_title($id)); $lname[] = get_post_meta($id, ‘last_name’, TRUE); $address[] = get_post_meta($id, ‘address’, TRUE); $cinfo[] = get_post_meta($id, ‘contact_info’, TRUE); endforeach; $data = [‘fname’=>$name, ‘lname’=>$lname, ‘address’=>$address, ‘cinfo’=>$cinfo]; <script> … Read more

Custom Taxonomy Tags and Category using same slug

So I got this working by adding /tag or /category for the rewrite slug, rather then publications or publications/%publications_tag%. I initally thought both taxonomy types could live in the parent post-type and wordpress would figure the rest out. Tags: ‘rewrite’ => array( ‘slug’ => ‘publication/tag’, ‘with_front’ => false ), Looks like: domain.test/publications/tag/example-tag/ and use’s the … Read more

How to create User friendly URL in WordPress?

There is a simple solution for this. Add this code to your theme’s functions.php. After that you need to re-save your permalinks from Settings->Permalinks in WordPress dashboard. function remove_author_base() { /** * Remove Author base from Wp Links * Serkan Algur */ global $wp_rewrite; $wp_rewrite->author_base=””; } add_action(‘init’, ‘remove_author_base’, 1); I tested this code on my … Read more