Jump to content

tascam424

Members
  • Posts

    29
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

tascam424's Achievements

Member

Member (2/5)

0

Reputation

  1. I have a lot of learning to do and i think this could be a great way to push to learn. Just getting the correct direction and start point is what i need. Your response is extremely valuable. Thank you so much.
  2. Hi folks, i'm Jonny, very amateur coder on the learning path. I have inherited a web script that fails on anything above php 7.4, creating lots of 500 errors. Although it works i WAMP localhost on PHP 8.0.26 it will not function correctly on any live server above php 7.4 (this has been reported by many users across different hosting providers. So as it is no longer supported by the developer, i am going to attempt to make it compatible. My question to the community is, is there any kind of programmes that will assist me in doing so ? Maybe something that will find deprecated code and suggest a better way of coding for forward compatibility ? I look forward to hearing your thoughts and suggestions.
  3. I'm trying to out put all Crelly Slider Alias's within Redux Framework Options in a Dropdown Select. I must confess i'm a novice at PHP ... I've attached the code from within Crelly Slider to show how it outputs the Alias names and i've also attached the Redux Code for the dropdown with an existing select .. I somehow need to output a list of all Crelly Alias's into 'options' => array( 'asc' => 'Ascending', 'desc' => 'Descending' ), Obviously replacing the exisiting options. Here is the full Crelly Output <?php global $wpdb; $sliders = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'crellyslider_sliders'); if(!$sliders) { echo '<div class="cs-no-sliders">'; _e('No Sliders found. Please add a new one.', 'crellyslider'); echo '</div>'; echo '<br /><br />'; } else { ?> <table class="cs-sliders-list cs-table"> <thead> <tr> <th colspan="5"><?php _e('Sliders List', 'crellyslider'); ?></th> </tr> </thead> <tbody> <tr class="cs-table-header"> <td><?php _e('ID', 'crellyslider'); ?></td> <td><?php _e('Name', 'crellyslider'); ?></td> <td><?php _e('Alias', 'crellyslider'); ?></td> <td><?php _e('Shortcode', 'crellyslider'); ?></td> <td><?php _e('Actions', 'crellyslider'); ?></td> </tr> <?php foreach($sliders as $slider) { echo '<tr>'; echo '<td>' . $slider->id . '</td>'; echo '<td><a href="?page=crellyslider&view=edit&id=' . $slider->id . '">' . $slider->name . '</a></td>'; echo '<td>' . $slider->alias . '</td>'; echo '<td>[crellyslider alias="' . $slider->alias . '"]</td>'; echo '<td> <a class="cs-edit-slider cs-button cs-button cs-is-success" href="?page=crellyslider&view=edit&id=' . $slider->id . '">' . __('Edit Slider', 'crellyslider') . '</a> <a class="cs-delete-slider cs-button cs-button cs-is-danger" href="javascript:void(0)" data-delete="' . $slider->id . '">' . __('Delete Slider', 'crellyslider') . '</a> </td>'; echo '</tr>'; } ?> </tbody> </table> <?php } ?> <br /> <a class="cs-button cs-is-primary cs-add-slider" href="?page=crellyslider&view=add"><?php _e('Add Slider', 'crellyslider'); ?></a> And my Redux Option array( 'id' => 'alias_select', 'type' => 'select', 'title' => __( 'Alias Select', 'ultra-web-admin' ), 'desc' => __( 'Select Slider Alias.', 'ultra-web-admin' ), 'options' => array( 'asc' => 'Ascending', 'desc' => 'Descending' ), 'default' => 'asc' ), I would be really grateful if anyone could assist me . Thank you !
  4. Greatly appreciated ! I'm just learning all this and a point in the right direction is much more valuable than somebody pasting a code snippet. Nice to know i got it right too .. Thanks a lot !!
  5. Thanks for pointing me in the correct direction .. So i worked out a solution, but baring in mind i am an absolute newb, would you mind telling me if this is the cleanest way to achieve what i want. It works perfectly ! <?php $categories = get_the_category(); $category_names = array(); foreach ($categories as $category) { $category_names[] = $category->cat_name; } echo implode (',', $category_names); ?>
  6. Hi guys, i'm attempting to display Wordpress Categories per Post. I'm aware of this simple standard method <?php the_category( ', ' ); ?>. But i actually just want a list of the categories, unformatted and unlinked to the category itself, actually i just want the category name. So i am using this method <?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?> This works perfectly if the post only has 1 category, but in the event of multiple categories, there is no separator. Could anybody assist me in adding a separator which will not append to the last in the list ? I would be grateful for any assistance but please bare in mind i am a mere novice. Thanks
  7. Hi guys, i'm hoping someone can point me in the right direction here. I'm importing products into WooCommerce using WP All Import through a XML feed. I need a way to get certain data from the category field, which looks like this .. <range category='Cars'>Cars </range><range category='Vans'>Vans </range><range category='Lorries'>Lorries </range> I need to somehow convert this to Cars, Vans, Lorries I'm not really sure how to approach this, any help would be greatly appreciated.
  8. Ahhhh ok, i totally miss-understood .. I am just trying to learn php, as i'm sure you could tell. Thank you very much for your help, it is greatly appreciated !!
  9. Yeh i have been reading the manual, which is how i got this far. Ive also been looking at other functions to try and understand how they can be combined. I tried this function other_checkstr($x){ str_replace("Large","",$x); if(strpos($x,'-')==FALSE){ return trim(substr(strrchr($x, ' '), 1 )); }else{ return trim(substr($x,0, strpos($x,'-')),'-'); } } The function runs the second part successfully as required, but the str_replace has no effect.
  10. So i somehow need to combine this function other_checkstr($x){ if(strpos($x,'-')==FALSE){ return trim(substr(strrchr($x, ' '), 1 )); }else{ return trim(substr($x,0, strpos($x,'-')),'-'); } } and this str_replace("Large","","$x"); Ive tried multiple combinations, but i can't seem to get it to work. Can anybody help me please ? Thank you !
  11. I appreciate your response, but i would be really greatfull if you could help me further, i really have no idea how to contain it within my existing function.
  12. Thanks guys, this is now working for me, but i need to add to it do also remove the word "Large" from the start of the string, it is consistantly the first word in the string and it is the same word always. What would be the best way to add it to this function to do both. function other_checkstr($x){ if(strpos($x,'-')==FALSE){ return trim(substr(strrchr($x, ' '), 1 )); }else{ return trim(substr($x,0, strpos($x,'-')),'-'); } }
  13. Apparently it is !! Now i feel a little stupid ! Thank you both for your help !
  14. Well i can do that and that seems like the perfect option but is it as simple as renaming the function like so ? function this_is_my_other_checkstr($x){ if(strpos($x,',')==FALSE){ return trim(substr(strrchr($x, ' '), 1 )); }else{ return trim(substr($x, 0, strpos($x,',')),','); } } Thanks for your input !
  15. I should probably provide more information, i am using WP All Import to import a product csv. The Product titles appear like so : Crossover Crop Top In Burgundy, Burgundy So my first function allows me to extract "Burgundy" from the end to use as Category/Color My second function should strip ",Burgundy" from the end to leave me Crossover Crop Top In Burgundy to use as Product Title. As these are pulled into different fields i can use the same column name with multiple functions, unfortunately it would appear that i can't declare the same function twice in function.php.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.