Skip to content

Instantly share code, notes, and snippets.

ellegaarddk ellegaarddk

View GitHub Profile
@ellegaarddk
ellegaarddk / slider_cpt.php
Created Oct 22, 2018
creating custom post type for frontpage slider
View slider_cpt.php
<?php
/* creating custom post type for frontpage slider
* By ellegaard ID - www.eid.dk
*/
add_action('init', 'create_frontpagepic');
function create_frontpagepic() {
$feature_args = array(
'labels' => array(
'name' => __( 'Forsidebilleder' ),
@ellegaarddk
ellegaarddk / wpml_show_default.php
Last active Mar 6, 2019
Show default version if translation isn't found
View wpml_show_default.php
<?php
add_filter('icl_ls_languages', 'wpml_ls_filter');
function wpml_ls_filter($languages) {
global $sitepress;
$default_url = $languages[$sitepress->get_default_language()]['url'];
foreach($languages as $lang_code => $language){
if($languages[$lang_code]['missing']==1){
$languages[$lang_code]['url'] = $default_url;
@ellegaarddk
ellegaarddk / create_product_cpt
Created Oct 22, 2018
Opret Custom Post Type til produkter
View create_product_cpt
function eid_cpt_produkt() {
$labels = array(
'name' =&gt; _x( 'Produkter', 'Post Type General Name', 'eid_domain' ),
'singular_name' =&gt; _x( 'Produkt', 'Post Type Singular Name', 'eid_domain' ),
'menu_name' =&gt; __( 'Produkter', 'eid_domain' ),
'parent_item_colon' =&gt; __( 'Produkt over:', 'eid_domain' ),
'all_items' =&gt; __( 'Alle produkter', 'eid_domain' ),
'view_item' =&gt; __( 'Vis produkt', 'eid_domain' ),
@ellegaarddk
ellegaarddk / woo_add_SKU_cat_pages
Created Oct 22, 2018
Tilføj SKU fra WooCommerce på kategorisider
View woo_add_SKU_cat_pages
/* WooCommerce - add SKU on cat pages */
add_action( 'woocommerce_after_shop_loop_item_title', 'shop_sku', 5 );
function shop_sku(){
global $product;
echo '<span itemprop="productID" class="sku">' . __('SKU', 'woocommerce'). ': ' . $product->sku . '</span>';
}
View remove_woocommerce_widgets.php
//* Remove unused Woocommerce widgets */
function eid_unregister_woo_widgets() {
// unregister_widget( 'WC_Widget_Recent_Products' );
unregister_widget( 'WC_Widget_Featured_Products' );
// unregister_widget( 'WC_Widget_Product_Categories' );
unregister_widget( 'WC_Widget_Product_Tag_Cloud' );
unregister_widget( 'WC_Widget_Cart' );
// unregister_widget( 'WC_Widget_Layered_Nav' );
// unregister_widget( 'WC_Widget_Layered_Nav_Filters' );
unregister_widget( 'WC_Widget_Price_Filter' );
@ellegaarddk
ellegaarddk / rename_CTP_title.php
Last active Oct 22, 2018
Omdøb titelfelt i Custom Post Type
View rename_CTP_title.php
function change_default_title( $title ){
$screen = get_current_screen();
if ( $screen->post_type == 'your_custom_post_type' ) {
return __( Skriv din egen tekst her', 'lang_domain' );
}
}
add_action('init', 'change_default_title');
@ellegaarddk
ellegaarddk / stopwords_DA.txt
Created Oct 4, 2018
Liste af relevante stopwords / stopord til indekseringer mm
View stopwords_DA.txt
ad, af, aldrig, alle, alt, anden, andet, andre, at, bare, begge, blev, blive, bliver, da, de, dem, den, denne, der, deres, det, dette, dig, din, dine, disse, dit, dog, du, efter, ej, eller, en, end, ene, eneste, enhver, er, et, far, fem, fik, fire, flere, fleste, for, fordi, forrige, fra, få, får, før, god, godt, ham, han, hans, har, havde, have, hej, helt, hende, hendes, her, hos, hun, hvad, hvem, hver, hvilken, hvis, hvor, hvordan, hvorfor, hvornår, i, ikke, ind, ingen, intet, ja, jeg, jer, jeres, jo, kan, kom, komme, kommer, kun, kunne, lad, lav, lidt, lige, lille, man, mand, mange, med, meget, men, mens, mere, mig, min, mine, mit, mod, må, ned, nej, ni, nogen, noget, nogle, nu, ny, nyt, når, nær, næste, næsten, og, også, okay, om, op, os, otte, over, på, se, seks, selv, ser, ses, sig, sige, sin, sine, sit, skal, skulle, som, stor, store, syv, så, sådan, tag, tage, thi, ti, til, to, tre, ud, under, var, ved, vi, vil, ville, vor, vores, være, været
@ellegaarddk
ellegaarddk / functions.php
Created Aug 23, 2018
WordPress: Remove not needed widgets from Genes framework by StudioPress
View functions.php
/**
* Unregister Genesis widgets
*
* Include in theme's functions.php or create your own functions plugin
* Comment out needed widgets
*/
function eid_rem_genesis_widgets() {
unregister_widget( 'Genesis_eNews_Updates' );
// unregister_widget( 'Genesis_Featured_Page' );
// unregister_widget( 'Genesis_Featured_Post' );
@ellegaarddk
ellegaarddk / remove_widgets.php
Created Aug 23, 2018
WordpRess: Remove not needed widgets from backend
View remove_widgets.php
/*
* Remove unneccesary default widgets from backend
* Comment out what you wish to see
*/
function unregister_default_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Links');
unregister_widget('WP_Widget_Meta');
@ellegaarddk
ellegaarddk / URL_change.sql
Last active Apr 22, 2018
Skift af URL til https
View URL_change.sql
##Ret prefix og domæner!!!!
UPDATE wp_posts SET post_content = replace(post_content, 'http://domain.dk', 'https://domain.dk');
UPDATE wp_posts SET guid = REPLACE (guid, 'http://domain.dk', 'https://domain.dk') WHERE post_type = 'attachment';
UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'http://domain.dk', 'https://domain.dk');
UPDATE wp_comments SET comment_content = replace(comment_content, 'http://domain.dk', 'https://domain.dk');
You can’t perform that action at this time.