Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1431 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1431 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1431 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Undefined variable $blocks in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441 Warning: Trying to access array offset on value of type null in /customers/c/9/8/wpin4.1prod.one/httpd.www/landing-v2/wp-content/themes/onecom-landing-page-v2/functions.php on line 1441

Vad är en kortkod (shortcode)?

Vi förklarar allt du behöver veta om kortkoder

En kortkod är en kort + kod. För att definiera hur en kortkod ska användas skriver du kortkoden inom parentes [så här].

Kortkoder gör att vissa funktioner kan fungera på din webbplats. Till exempel kräver vissa plugins en kortkod för att fungera korrekt, annars kommer besökare inte att kunna se funktioner för de plugins som du har installerat. Ett annat exempel på när du ska använda en kortkod är när du formaterar innehållet och strukturen på din webbplats. Om du exempelvis vill lägga till kontaktformulär eller en pristabell kan en kortkod snabbt hjälpa dig med det.

Kortkod i WordPress – exempel

Du kanske undrar hur en kortkod fungerar i WordPress och vilka funktioner den egentligen har.

Låt oss säga att du vill skapa olika flikar på din webbplats. Du vill till exempel ha tre olika flikar, en flik kan handla om dig, en flik kan innehålla din kontaktinformation och den sista fliken kan handla om en produkt/tjänst du erbjuder. För att flikarna ska fungera korrekt behöver du skriva och lägga till en kortkod i WordPress.

Något i stil med detta:

[tabs]  – detta öppnar alla dina flikar.

[tab title = “Om mig”] – det är här vi skriver namnet på den första fliken och här vi skapar den första fliken.

Flikinnehåll 1. – det är här allt ditt innehåll kommer att hamna, inuti den första fliken.

[/tab] – detta stänger den andra fliken.

[tab title= “Kontakta mig”] – det är här vi skriver namnet på den andra fliken och här vi skapar den andra fliken.

Flikinnehåll 2. – det är här allt ditt innehåll kommer att hamna, inuti den andra fliken.

[/tab] – detta stänger den andra fliken.

[tab title= “Blommor av mig”] – det är här vi skriver namnet på den tredje fliken.

Flikinnehåll 3. – det är här vi skriver namnet på den tredje fliken och här vi skapar den tredje fliken.

[/tab] – detta stänger den tredje fliken.

[/tabs] – detta stänger alla dina flikar.

När du installerar och aktiverar ett plugin behöver du inte hantera HTML och PHP. Skaparen av det plugin du använder har redan gjort allt detta. Du behöver bara använda kortkoder som den ovan för att skapa en miljö för att pluginet ska fungera korrekt. Det är betydelsen av kortkoder: att skapa en miljö för dina installerade plugins.

Du kan också, som nämnts ovan, använda kortkoder för att bädda in en video på din WordPress-webbplats. Kortkoden skulle då kunna se ut såhär:

[youtube=http://www.youtube.com/watch?v=76IPdrSExzs]

Om du skriver den här kortkoden visas denna video:

Var lägger man till kortkod i WordPress?

Nu när vi vet mer om vad en WordPress-kortkod gör och hur en kortkod kan se ut, låt oss gå in på hur man lägger till en kortkod i WordPress och i dina inlägg.

Du kan ta vilken plugin som helst på din panel i WordPress. Vissa plugins genererar kortkoden åt dig och du behöver bara kopiera och klistra in den på en av dina sidor. Den här metoden är enkel och okomplicerad eftersom du inte behöver skriva någon kod. Istället kopierar du bara WordPress-kortkoden som genereras av plugin-programmet och klistrar in den i kodversionen av ditt WordPress-inlägg, och voilà, plugin-programmet kommer att fungera.

Om du till exempel vill visa plugin-programmet i ditt sidofält (widget), och plugin-programmet inte genererar en kortkod för det ändamålet, kan du fortfarande få det att fungera.

Gå till din Editor i din instrumentpanel och se till att du har gjort en kopia av dina filer genom att använda ett barntema, så att du inte förlorar din data och skadar din webbplats. Gå sedan hela vägen ner till din PHP-fil och lägg till kortkodsraden som lägger till ett filter. Det kan vara en WordPress-kortkod som exempelvis add_filter(‘widget_text’, ‘do_shortcode’);

När du är klar uppdaterar du filen så ser du att din plugin/widget fungerar och visas i sidofältet.

När du vill visa ett plugin, till exempel ett fotogalleri, kommer kodavsnittet ovan att tillåta ditt tema att registrera ditt plugin på exakt den plats du vill ha det.