Back to Question Center
0

Uchwepheshe we-Semalt: Indlela Yokudala I-Plugin elula ye-WordPress

1 answers:

Ukudala i-plugin ye-WordPress yangokwezifiso kulula. Abantu abaningi bangathola ukuthi lesi sici sinenzuzo ukubhekana nokuguqulwa kwabo nezidingo eziningi. Ama-Plugin yizingcezu zekhodi ye-PHP eguqulela indlela iwebhusayithi yakho isebenza ngayo. Kungenzeka ukudala le khodi bese uyifaka kuwebhusayithi yakho ye-WordPress ngaphandle kokuguqula ikhodi eyinhloko yewebhusayithi. Kwezinye izimo, kungase kudingeke ungeze isici esiyingqayizivele kusayithi lakho, elinye elingenayo i-plugin yokuhweba eyenziwe ngomumo.

Kulesi sihloko se-SEO, esinikezwe u-Andrew Dyhan, isazi esihamba phambili esivela ku Semalt , uzofunda ukuthi ungakha kanjani i-plugin yakho ye-WordPress yangokwezifiso.

Isakhiwo esiyisisekelo se-WordPress plugin

Kulo mhlahlandlela we-SEO, sizogxila ekudaleni i-plugin ye-WordPress. Leli fayili elula ye-PHP equkethe imiyalelo kuyo. Ngombono wami we-SEO, kuhle ngaso sonke isikhathi ukudala ifolda bese ufaka ifayela le-PHP ngaphakathi. Le folda kufanele ibe negama elifanayo nelinye ku-plugin. Ngemuva kokudala le fayela, kubalulekile ukuyilayisha kufolda ye-wp-okuqukethwe / plugin kusikhungo sakho se-server. I-plugin inamasu ayisisekelo ambalwa. Isibonelo, kukhona isihloko.

Isihloko se-plugin ye-WordPress

I-header elula inesakhiwo esincane sokusebenza esingaziwa yi-WordPress. Isibonelo, sinalo:

Igama le-Plugin: I-Plugin yethu entsha

Lena ifomethi elula kakhulu yenhloko ye-plugin ehambisana nesistimu yokuphatha okuqukethwe kwe-WordPress. Ngokwenza lesi sinyathelo, uthola i-plugin esebenzayo ongayenza kusebenze endaweni yakho ye-plugin ye-WordPress. Noma kunjalo, ayikho imisebenzi kuwo. Ngakho ngeke kuguqule noma yikuphi ukusebenza kwewebhusayithi yakho. Inhloko ingabuye ibe nolunye ulwazi olufana nomlobi, incazelo, inguqulo, njll. Amanye alalu lwazi angadingeka ngezinjongo zokuthuthukisa esikhathini esizayo.

Okunye okuphelele kwe-plugin

Akukho mkhawulo emiyalweni ongayifaka kwi-plugin yakho..Noma kunjalo, kubalulekile ukucabangela impendulo yewebhusayithi yakho njengendlela yokwakha. Ukufaka ikhodi eningi kungenza isayithi lakho liguquke kakhulu. Ungashintsha i-plugin yakho ngangokunokwenzeka. Kuyifayili elula ye-PHP ongayishintsha njenganoma yiliphi isihloko, noma yikuphi ukuguqulwa ongayenza efonini yakho yemisebenzi.php. Kusukela eqinisweni, kubalulekile ukunciphisa izinguquko ongayifaka kuwebhusayithi ye-WordPress. Isibonelo, ngingasebenzisa le snippet ukusiza iwebhusayithi yami iqondise kabusha ikhasi kwenye, ngisho nakuwebhusayithi entsha ngokuphelele;

sebenzisa i-my_custom_redirect {

ukuthunyelwa kwe-$ jikelele;

uma (i-ikhasi || is_object (i-$ post)) {{8)

uma ($ ukuqondisa kabusha = get_post_meta ($ post-> ID, 'ukuqondisa kabusha', kuyiqiniso)) {{8)

i-wp_idlulise (i-redirect);

uphume;

add_action ('get_header', 'my_custom_redirect');

Le snippet inomsebenzi owodwa olula. Kungakuvumela ukuthi ungeze imeta yenkambiso kunoma yiliphi ikhasi. Ngaphezu kwalokho, kungakusiza ukuthi ungeze isiko 'sokuqondisa kabusha' usebenzisa i-URL ehlukile. Esihlokweni sami sangaphambilini, ukuxhuma konke kuzobukeka;

/ *

Igama le-Plugin: I-Plugin yethu entsha

sebenzisa i-my_custom_redirect {

ukuthunyelwa kwe-$ jikelele;

uma (i-ikhasi || is_object (i-$ post)) {{8)

uma ($ ukuqondisa kabusha = get_post_meta ($ post-> ID, 'ukuqondisa kabusha', kuyiqiniso))

i-wp_idlulise (i-redirect);

uphume;

add_action ('get_header', 'my_custom_redirect');

Kuyinto elula ukwakha i-plugin ye-WordPress yangokwezifiso. Njengalokhu kulesi simo ngenhla, senze i-plugin engakwazi ukuqondisa kabusha amakhasi. Ungakwazi futhi ukwengeza umugqa ohlukile wekhodi ye-PHP ukwenza imisebenzi ehlukene kwiwebhusayithi yakho ye-WordPress.

November 29, 2017
Uchwepheshe we-Semalt: Indlela Yokudala I-Plugin elula ye-WordPress
Reply