I would like to extract dimensions length, width and height from a single value 51x51x21cm into 3 separate fields using PHP in the Wordpress plugin WPAllimport.
Any idea how to solve this?
Thanks!
Menno
I use WP All Import frequently and it sounds like you will need to do one of the following:
Reformat your data in a spreadsheet software (i.e Microsoft Excel)
Using WP All Imports custom function editor, create a custom PHP function to split the data into 3 separate values and use their inline PHP syntax to output each value accordingly
If you have experience with PHP, the custom function editor mentioned above should be at the bottom of the "Edit Import" page when creating or editing an import. You can find more about the custom function editor here.
Related
I am working Apache solr search its working fine. But I need to change the search result to my view like title, date, short description and image.
Can you please someone help me. How to override the search result to custom result.tpl page.
There are several options :
Altering/adding template variables for individual search result by implementing hook_preprocess_search_result().
Altering the template file itself search-result.tpl.php (first you need to copy the original in your theme's templates folder).
The same can be done on the entire set of results (rows per page) using search-results.tpl.php & hook_preprocess_search_results().
Add custom CSS or override some rules in your theme.
I'm working on a project where I want to display product's image and customs attributes from Woocommerce.
I already set attributes like this
I want in my php code display all the attributes (title et terms).
I already try <?php $product->list_attributes(); ?>. It works fine but data are displaying in <table>. I want to customize the display.
Thanks for your help !
Whenever I get stuck with a custom method like this in WooCommerce, I try to resort to the docs to see what is going on.
If you inspect the source for this method, you'll find that it's actually using a custom template single-product/product-attributes.php to output this table you're seeing.
In order to change the output, you have two options:
Override the template via your theme
Observe single-product/product-attributes.php and use the information there to write your own custom loop in your original template.
The second option means that you'll likely use the get_attributes() method, instead of list_attributes().
I've created two custom field groups in a temporary wordpress install and would now like to use the export of them to import them into a new wordpress install, however it doesn't seem like there's a way.
How have others done this?
Advanced Custom Fields stores the field groups as Custom Post Types, so the XML export is compatible with the standard WordPress XML format, and can be imported using the WordPress Importer plugin.
You can also get to the install directly by visiting /wp-admin/import.php on your site (under Admin > Tools > Import) and clicking the WordPress link at the bottom. Once installed you just need to import the XML export file you created for the ACF field groups.
For importing from ACF 4 (exported to PHP) to ACF 5 Pro I used ACF-PHP-Recovery. Works like a charm.
To build on antongorodezkiy's answer:
His suggestion to use ACF-PHP-Recovery worked for me, but I had to make a couple of other edits first. My ACF 4.x PHP export used the function "register_field_group". But the ACF website references the function "acf_add_local_field_group". The property fields of both functions are almost identical -- the one major difference is that the old function used 'id' as one of its first keys, and the new function uses 'key'.
Making those changes to the PHP allowed the ACF-PHP-Recovery plugin to recognize my ACF data and import it.
By the way, the generated PHP goes into your functions.php file. Once you've used the plugin to upload the data, remove the PHP from functions.php.
I have created an Article in Drupal 7 and I want to customize how the content is displayed.
I am trying to modify the node.tpl.php, which gives you access to the $content variable, but this is a multidimensional array and I cannot extract the keys or values within it.
Is there a way of seeing inside $content to find out the exact value pairs that I need?
Or is there another way of customizing the display and output of Drupal 7 content?
If you install the and enable the devel module, it gives you access to a very handy function dsm that will render a widget that lets you explore the contents of any variable or object. So in your node.tpl.php file: dsm($content); at the top will let you inspect the content. Usually you will want to create a custom node-type.tpl.php file e.g. node-article.tpl.php which is only applied to nodes of a certain type.
I'm only really a novice with PHP (and I know I'm sortof trying to run before I can walk), but I would like to know if it is possible to define a functions name via a textfield.
Currently, I am working with Wordpress so I can use add_option to add something to the database to store data, etc, which is handy. My idea is for a slideshow plugin which allows you to have unlimited slideshows.
It would work by typing the name into the text box then clicking the submit button to store the name. This name would then be given to a function which can be used to display that specific slideshow. Is this possible?
Sorry if this seems confusing. I know what I want to achieve, I just don't have a clue how (but I am willing to learn). Thanks.
Why do you need new functions? Sounds more like the same funxtion with different arguments, which can easily be your textfield value
1.your plugin admin page allows naming and creating slideshows, like creating a post or a gallery with a title, and adding images.
2.you place a function call in your theme where you want a slideshow to appear:
if(function_exists('display_slideshow')){display_slideshow($slideshow_name)};
3.the function display_slideshow() is included in your plugin file.
function display_slideshow($slideshow_name){
//get slideshow stuff from the database,
//using the name of the show passed as arg
//write your html and php to show the images the way you design
}