Saturday , February 22 2025

iryna

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

How to randomly display multiple words using PHP

Without long preliminary explanations, I am posting the working code here. <?php $input = array("test1", "test2", "test3", "test4", "test5", "test6", "test7", "test8", "test9", "test10"); $rand_keys = array_rand($input, 5); echo $input[$rand_keys[0]] . ", "; echo $input[$rand_keys[1]] . ", "; echo $input[$rand_keys[2]] . ", "; echo $input[$rand_keys[3]] . ", "; echo $input[$rand_keys[4]] …

Read More »

ACF not showing up in WooCommerce categories

By default, ACF fields can be displayed like this: <?php the_field('slogan');?> or like this: <?php if( get_field("slogan") ): ?> <?php the_field( "slogan" ); ?> <?php else :?> Custom text if needed. <?php endif; ?> In WooCommerce, this construction does not work, below are correct code example: $queriedObject = get_queried_object(); echo …

Read More »

How to add custom CSS for WordPress admin panel

If you need to place a few CSS lines for the admin panel, then edit the file functions.php at the root of the theme, and add it to the end of the file: add_action('admin_head', 'admin_styles'); function admin_styles() { echo '<style> .update-nag {display: none !important;} </style>'; } Instead of the .update-nag …

Read More »

301 redirect in PHP

There are different reasons for different engines to add 301 redirects not in .htaccess. For DLE, PHP redirects are the only way to avoid looking at dynamic garbage generated in links. Examples implementation in PHP: if ( getenv('REQUEST_URI') == '/page-before-redirect/' ) { header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: …

Read More »