Skip to content

Instantly share code, notes, and snippets.

View pixelbart's full-sized avatar
👋
Hi

Kevin Pliester pixelbart

👋
Hi
View GitHub Profile
@pixelbart
pixelbart / readme.md
Created August 13, 2020 18:26
Using Helpful WordPress Plugin on archive pages

Using Helpful on archive pages

With these two scripts Helpful can be used as short code on archive pages. Place the code in your functions.php to make it work.

In the first script the_content is manipulated and in the second script the_excerpt. Use what you have in use.

Quick tip: Use get_post_type( $post ) to check if a particular post type is in use.

@pixelbart
pixelbart / like_linkedin_post.js
Created August 13, 2020 12:35
Click on the Like button on all visible posts by Linkedin - just paste it into your browser console
document.querySelectorAll('.feed-shared-social-actions').forEach(function(element) {
if ("true" !== element.children[0].children[0].getAttribute('aria-pressed')) {
element.children[0].children[0].click();
}
});
@pixelbart
pixelbart / functions.php
Last active August 11, 2020 18:48
Helpful Plugin: Anker zum Formular
<?php // functions.php
/**
* Fügt Helpful eine ID hinzu.
*
* @param string $content
*
* @return string
*/
add_filter( 'the_content', function( $content ) {
@pixelbart
pixelbart / chosen.less
Created August 6, 2020 15:12
Easy Less conversion of the Chosen jQuery plugin.
.chosen-container {
width: 100%;
max-width: 100%;
position: relative;
display: inline-block;
vertical-align: middle;
font-size: 13px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
@pixelbart
pixelbart / coreDIRSEPmodulesDIRSEPclass-my-class.php
Last active June 15, 2020 08:44
WordPress Plugin: A plugin which includes or autoloads classes with namespaces.
<?php
/**
* An example class in the subfolder: core/modules/core.php
*/
namespace NAMESPACE\Core\Modules;
class My_Class
{
/**
* Saves an instance of the class.
@pixelbart
pixelbart / style.css
Created June 5, 2020 12:53
CSS: Use Font Awesome 5 Free and the correct font family
/**
* https://fontawesome.com/icons/long-arrow-alt-right?style=solid
*/
.long-arrow-alt-right:after {
content: "\f30b";
font-weight: 900;
font-family: "Font Awesome\ 5 Free";
}
@pixelbart
pixelbart / database.php
Created May 7, 2020 14:09
Helper for WordPress database.
<?php
/**
* Helper for WordPress database.
*
* @author Pixelbart
*/
class Database_Helpers
{
/**
* Checks if a database exists.
@pixelbart
pixelbart / session.php
Created May 7, 2020 14:08
Checks if a PHP session is running and starts it if not.
<?php
if ( PHP_SESSION_NONE == session_status() ) {
session_cache_limiter( '' );
header( "Cache-Control: public, s-maxage=60" );
session_start();
}
@pixelbart
pixelbart / footer.php
Created April 15, 2020 14:43
Google Analytics Embed
@pixelbart
pixelbart / generatePassword.php
Last active February 18, 2020 15:40 — forked from zyphlar/generatePassword.php
Generating secure passwords in PHP
<?php
/**
* Generates random, secure bytes that will be used for the password.
*
* @param int $nbBytes
* @param bool $strong
*
* @return string
*/
function get_random_bytes( $nbBytes = 32, $strong = true ) {