Skip to the content

nano.cat

Snippets of Mălin Cenușă

  • Home
  • Categories
  • Malware Samples
  • mălin.ro
  • blackhat.pm
  • palma.solutions

Fix bug with Ordo theme

Date: November 12, 2020
Categories: Wordpress, CMS, PHP, Programming & Scripting

Fixes a bug with the Ordo theme where the frontpage gets reset to null:

$homepage = get_page_by_title( ‘Front…

[root@nano.cat]# Check it out!

Track execution time for PHP script

Date: October 17, 2020
Categories: PHP, Programming & Scripting

Track CPU time for PHP script:

Reference: https://stackoverflow.com/questions/535020/tracking-the-script-execution-time-in-php

Adjust excerpt length in WordPress

Date: May 9, 2020
Tags: excerpt length, functions.php, PHP, programming, Wordpress
Categories: CMS, PHP, Programming & Scripting, Wordpress

Add this to functions.php to achieve it:

function mytheme_custom_excerpt_length( $length ) {
return 20;
}
add_filter( ‘excerpt_length’, ‘mytheme_custom_excerpt_length’, 999 );

…

[root@nano.cat]# Check it out!

cURL via PHP

Date: April 28, 2020
Tags: API, cURL, JSON, PHP
Categories: Programming & Scripting, PHP

Pull the result of a cURL query via PHP.

Useful for parsing JSON APIs

$ch = curl_init();curl_setopt($ch,…

[root@nano.cat]# Check it out!

Hide DIV on specific pages

Date: April 24, 2020
Tags: hide content, PHP
Categories: PHP, Programming & Scripting

PHP snippet to hide a specific DIV or content from specific pages:

<?php if (strpos($_SERVER[‘REQUEST_URI’],’/checkout/’) === false ||…

[root@nano.cat]# Check it out!

Snippets navigation

Older snippets
1 2

Categories



© 2021 nano.cat. All rights reserved. Powered by WordPress.