Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Copa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Qué, por qué y cómo crear un plugin de WordPress para un sitio específico

¿Desea añadir un plugin específico para su sitio web WordPress?

Un plugin específico para cada sitio le permite añadir fácilmente fragmentos de código a su sitio web WordPress sin depender de su tema.

En este artículo, explicaremos cómo crear un plugin de WordPress específico para un sitio y por qué es importante.

Site Specific WordPress Plugin

¿Qué es un plugin de WordPress específico para un sitio?

Un plugin de WordPress específico para un sitio es un plugin independiente que puede utilizar para añadir todos los fragmentos de código de personalización que no dependen del tema.

Cuando trabaje en su sitio web, a menudo encontrará tutoriales de WordPress que le pedirán que añada código al archivo functions.php de su tema o a un plugin específico del sitio.

WordPress no incluye plugins específicos para cada sitio. Tendrás que crear el tuyo propio y luego instalarlo y activarlo.

¿Por qué crear un plugin de WordPress específico para un sitio?

Como hemos mencionado antes, a menudo encontrarás tutoriales que muestran algún código que puedes añadir al archivo functions. php de tu tema o a un plugin específico del sitio.

Estos códigos personalizados se pueden utilizar para añadir nuevos tipos de contenido entradas, taxonomías, shortcodes, y toneladas de hacks para mejorar su sitio web.

Si añades el código personalizado al archivo de funciones de tu tema, desaparecerá si actualizas o cambias de tema.

Puede crear un tema hijo y utilizar el archivo de funciones del tema hijo para guardar su código. Sin embargo, tu código desaparecerá si cambias de tema.

Un plugin de WordPress específico para cada sitio te permite añadir fácilmente fragmentos de código personalizados a tu sitio web de WordPress y asegurarte de que son independientes del tema. Es un plugin de WordPress independiente, lo que significa que no depende de su tema, y usted es libre de actualizar o cambiar su tema.

Dicho esto, echemos un vistazo a cómo añadir fácilmente código personalizado utilizando un plugin específico del sitio. Le mostraremos dos maneras de hacerlo, y usted puede elegir el método que funcione mejor para usted (pista: Método # 2 es más fácil para los principiantes).

Método 1: Crear manualmente un plugin de WordPress específico para cada sitio

Sabemos que esto puede sonar un poco friki para los principiantes, pero intentaremos simplificártelo al máximo.

En primer lugar, debes crear una nueva carpeta en tu escritorio y darle el nombre de tu sitio web. Por ejemplo: mywebsite-plugins.

Creating your site-specific plugin folder

Ahora, abre un editor de texto plano en tu ordenador como Notepad o TextEdit.

Debe crear un nuevo archivo y guardarlo como mywebsite-plugin.php en la carpeta de plugins de su escritorio.

Creating the plugin file for your site-specific plugin

El archivo de su plugin necesita un código de cabecera específico para que WordPress pueda reconocerlo como plugin. Siga adelante y añada el siguiente código a su archivo mywebsite-plugin.php:

<?php
/*
Plugin Name: Site Plugin for example.com
Description: Site specific code changes for example.com
*/
/* Start Adding Functions Below this Line */

/* Stop Adding Functions Below this Line */
?>

Puede sustituir example.com por su propio nombre de dominio. Una vez hecho esto, el plugin específico de su sitio estará listo.

Hay dos formas de subir un plugin específico para un sitio web. Puede subirlo a través de su panel de administrador de WordPress o utilizar FTP.

1. Instalar plugin específico del sitio desde el área de administrador de WordPress (recomendado)

Este método es más sencillo y recomendable para todos los usuarios.

En primer lugar, debe crear un archivo zip con la carpeta de plugins específica de su sitio.

Los usuarios de Windows sólo tienen que hacer clic con el botón derecho del ratón en la carpeta de plugins y seleccionar Enviar a ” carpeta comprimida (zip).

Creating zip file in Windows

Los usuarios de Mac deben hacer clic con el botón derecho.

A continuación, seleccione “Comprimir mywebsite-plugin”.

Creating a zip folder on Mac

Una vez que tenga el archivo zip del plugin, vaya a la página Plugins ” Añadir nuevo en su área de administrador de WordPress.

A continuación, haga clic en el botón “Subir plugin” de la parte superior.

upload plugin

A continuación, haz clic en el botón “Elegir archivo” para seleccionar el archivo zip que has creado antes y, a continuación, haz clic en el botón “Instalar ahora”.

WordPress subirá e instalará el plugin. Una vez subido, deberá hacer clic en el botón “Activar plugin” para empezar a utilizar el plugin específico de su sitio.

Activate plugin

2. Suba el plugin de WordPress específico de su sitio a través de FTP

Para este método, no es necesario crear un archivo zip. Subirá el plugin a través de FTP.

En primer lugar, deberá conectarse a su sitio web mediante un cliente FTP.

Una vez conectado, vaya a la carpeta /wp-content/plugins/ en la columna del sitio remoto. A continuación, debe seleccionar la carpeta de plugins específica de su sitio y subirla a su sitio web.

Uploading plugin via FTP

Su cliente FTP transferirá la carpeta de plugins específica de su sitio a su sitio web WordPress. Esto instalará el plugin en su sitio web.

Sin embargo, deberá activar el plugin para empezar a utilizarlo. Para ello, vaya a la página “Plugins” del área de administración de WordPress y haga clic en el enlace “Activar” situado debajo del plugin específico de su sitio.

Activate plugin

Eso es todo. Su plugin específico del sitio está listo para ser utilizado.

Añadir fragmentos de código personalizados a su plugin específico del sitio

Hay dos formas de editar su plugin y añadirle fragmentos de código personalizados.

El primer método es hacerlo a través del área de administrador de WordPress. Puedes ir a la página Plugins ” Editor.

Verá un mensaje de advertencia y deberá hacer clic en el botón “Entiendo” para continuar. Alternativamente, si desea una forma más segura de editar los archivos, omita el segundo método a continuación.

Heads up warning in the plugin editor tool

A continuación, seleccione el plugin específico de su sitio en el menú desplegable “Seleccionar plugin para editar”.

El editor cargará tu archivo de plugins y podrás añadirle fragmentos de código.

Select a plugin to edit in the plugin file editor tool

Cuando haya terminado, haga clic en el botón “Actualizar archivo” para guardar los cambios.

Si falta algo en el código o puede romper tu sitio web, el editor de plugins deshará automáticamente los cambios.

Sin embargo, si el editor falla, y ves la pantalla blanca de la muerte, entonces puedes usar FTP para editar el archivo de tu plugin y deshacer esos cambios.

El segundo método consiste en editar directamente el archivo del plugin mediante FTP. Simplemente vaya a la carpeta de plugins utilizando su cliente FTP. Haga clic con el botón derecho del ratón en el archivo del plugin y seleccione “Ver/Editar”.

Editing plugin file via FTP

También puede descargar el archivo del plugin a su ordenador, editarlo y volver a subirlo.

Método 2: Añadir código personalizado usando WPCode (Recomendado)

Este método es mucho más sencillo y le ofrece una mejor forma de gestionar sus fragmentos de código individuales en WordPress utilizando WPCode.

Lo primero que tienes que hacer es instalar y activar el plugin gratuito WPCode en tu sitio web. Para más detalles, consulta nuestra guía paso a paso sobre cómo instalar un plugin de WordPress.

Una vez activado, el plugin añadirá un nuevo elemento / artículo llamado “Fragmentos de código” a su menú de administrador de WordPress. Al hacer clic en él, accederás a una página en la que podrás gestionar todos tus códigos personalizados.

Para añadir su primer fragmento de código, haga clic en el botón “Añadir nuevo”.

Click the Add New Button to Add Your First Custom Code Snippet in WordPress

Accederá a la página “Añadir fragmento de código”. Aquí puede elegir un fragmento de código de la biblioteca prediseñada o añadir su código personalizado.

Para añadir código personalizado, vaya a la opción “Añadir su código personalizado (nuevo fragmento)” y haga clic en el botón “Usar fragmento”.

Add your new custom code snippet in WPCode

Ahora, puede introducir un título para su fragmento de código personalizado. Puede ser cualquier cosa que le ayude a identificar el código.

Después de eso, puede seguir adelante y pegar su fragmento de código en el cuadro de código. También debe seleccionar el tipo de fragmento de código PHP en la lista desplegable “Tipo de código” de la derecha.

Adding custom code

También puede añadir notas para el código en la sección “Información básica”.

En esta zona debe anotar qué hace este código, dónde lo encontró y por qué lo añade a su sitio web. Esto ayudará al “tú del futuro” a recordar por qué el “tú del pasado” añadió este código.

Add notes and tags to identify and organize your code snippets

También tiene la opción de asignar etiquetas a sus fragmentos de código, lo que puede ayudarle a organizarlos por debate y funcionalidad.

El plugin también te permite seleccionar cómo quieres ejecutar el fragmento de código. En la sección ‘Inserción’, puedes seleccionar el método ‘Auto Inserción’ para insertar y ejecutar automáticamente el código en tu sitio.

Puede elegir entre las opciones de área de administrador, front-end o en todas partes. Si no está seguro, mantenga la opción por defecto “Ejecutar en todas partes”.

Pick the insertion method for your custom code snippet

También puede elegir el método ‘Shortcode’. Con este método, el fragmento de código no se inserta automáticamente. Una vez que guarde el fragmento de código, obtendrá un shortcode que podrá insertar manualmente en cualquier parte de su sitio.

También puede utilizar la sección “Lógica condicional inteligente” para mostrar u ocultar fragmentos de código insertados automáticamente en función de una serie de reglas.

Use smart conditional logic to decide when snippets should load

Por ejemplo, puede cargar fragmentos de código solo para usuarios conectados, cargar fragmentos de código PHP solo en URL de páginas específicas, mostrar fragmentos de código en función del tipo de página, etc.

Por último, puede cambiar el conmutador de “Inactivo” a “Activo” y, a continuación, hacer clic en el botón “Guardar fragmento de código”.

Save and activate your custom code snippet

Si desea guardar el fragmento de código sin activarlo, solo tiene que hacer clic en el botón “Guardar fragmento”.

Una vez que haya guardado y activado un fragmento de código, éste entrará automáticamente en vigor en su sitio web si ése es el método de inserción que ha elegido.

Para más detalles, consulte nuestra guía sobre cómo añadir fácilmente fragmentos de código personalizados en WordPress.

Esperamos que este artículo te haya ayudado a aprender por qué y cómo crear un plugin de WordPress específico para un sitio. Es posible que también desee ver nuestra lista de consejos útiles archivo de funciones y los hacks de WordPress más buscados para utilizar mejor su plugin específico del sitio.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Descargo: Nuestro contenido está apoyado por los lectores. Esto significa que si hace clic en algunos de nuestros enlaces, podemos ganar una comisión. Vea cómo se financia WPBeginner , por qué es importante, y cómo puede apoyarnos. Aquí está nuestro proceso editorial .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

El último kit de herramientas de WordPress

Obtenga acceso GRATUITO a nuestro kit de herramientas - una colección de productos y recursos relacionados con WordPress que todo profesional debería tener!

Reader Interactions

119 comentariosDeja una respuesta

  1. Stephanie

    I’m getting the same error as Sonya above. Does anyone have a fix?

    Parse error: syntax error, unexpected T_LNUMBER in /home/statisu0/public_html/wp-content/plugins/statisticshowto-plugin/statisticshowto.com-plugin.php on line 10

  2. Susan

    Hi again. I’ve been reading through all of the comments above and, while some show your answer and resolution to the problem, many don’t. So it’s hard for me to learn from how others resolved their problems! Anyway, here’s what I’m wondering: if by following the instructions in this post to create a folder within my “plugins” folder, how will I be able to see my new site-specific plugin file?
    For example, I followed the instructions to create a folder called susansinthegarden-plugin. Then I put my plugin code in a file called susansinthegarden-plugin.php. I can’t see the plugin when I go to plugins on my dashboard.
    Is this because the new plugin text file exists in a sub-folder under “plugins”? I can’t figure out what I’m missing but really need to resolve this. Is there anyone out there who can help me? Thanks so much!

      • emy

        Hi,
        What is a plugin header and how do I format it?

        • WPBeginner Support

          Hey Emy,

          The plugin header is the part that tells WordPress that this file should be treated as a plugin. It also tells WordPress the name of the plugin, version, and other information.

          In the code shown above, the header part begins right after the first line and ends at line 5. It contains plugin’s title and description.

    • Susan

      OK, I resolved my program. Not being a code-writer, I didn’t realize that there was a separate header to wrap around the code I was borrowing. Duh. Thanks for your help.

  3. Susan

    I followed your instructions to create a folder under wp-content/plugins etc. and put the file containing the code into that folder but I can’t see my new plugin when I go to my dashboard and look under plugins. Did I miss a step? Thanks in advance for your help!

  4. Edgar Ramirez

    Hello

    I created the directory and the php file but i cannot see the plugin at all

    /wp-content/plugins/yoursitename-plugin/
    Open a blank file and save it as “yoursitename-plugin.php”

    dont see it on the dashboard plugin list and neither in the Plugin>editor

    Can you please help me

  5. Sonia Lacasse

    Never mind! Looks like I found the problem. Thanks for your awesome work! :)

  6. Sonia Lacasse

    When I try to activate the plugin, I get the following error message:

    Plugin could not be activated because it triggered a fatal error.
    Parse error: syntax error, unexpected ’06’ (T_LNUMBER) in /var/www/domain/wp-content/plugins/ETK-PLUGIN/ETK-PLUGIN.php on line 10

    Can you please help?

    Thanks!

  7. Catherine Argyros

    hi there, when i put this in the directory

    I received this error message

    The plugin generated 2 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.

    but my plug in is activated….. please help me understand what is going on?
    thank you

      • error message

        wonderful, thats exactly what the problem was. Thank you for helping me create my first plugin!

  8. xin a day

    “All you have to do is create a new folder in the plugins directory. Example: /wp-content/plugins/yoursitename-plugin/
    Open a blank file and save it as “yoursitename-plugin.php”
    Put the following code in the file:”

    i hv few question on these .

    1. i can’t create a folder onthe plugin directory.
    2. where to open a blank file ?
    3. the plugin diretory cant install that file.

    thank you

  9. Sacha

    Awesome idea! I’ve always found functions.php a pain, so this method works great!

  10. Alan Shapiro

    This is a really useful post–thank you! Perhaps someone else asked this and I just missed it in all the comments, but: will a site-specific plugin override a function that is in the theme’s functions.php? For instance, if there is a “remove_action” in the functions.php, will the same “add_action” in the plugin take precedence?

    • WPBeginner Support

      Both functions.php file and site-specific plugin are treated as plugins. Functions.php file loads after plugins but they do not have precedence over eachother. This is why using the same function in both files can cause unexpected results. The best way to override pluggable code is by using hooks and filters.

      Administrador

  11. Robert Masters

    I’m building a plugin at the moment for a multisite network and I need certain functionality available only in specific sites, so this is a perfect article for me right now.
    I have one question though…..how do I name the site plugin folder for a site that is created as a subdomain? Example: subdomain.mainsite.com would it be subdomain-mainsite-plugin or just subdomain-plugin?
    Hope this makes sense, question based on your tutorial.

  12. hans

    very good. when you create a second instance don’t forget do give the “register and load” function an own name, like i did ;)

  13. Eric Ellis

    That’s great. I always figured it was pretty simple. Thank you for the information.

  14. Jide

    Nice one there. Kindly update the post to inform readers that after activating the plugin, they will have to click on the “edit” link on the plugins page, to add their codes.

    Most newbies might not know this…

    • WPBeginner Support

      Actually we do not recommend editing plugins and themes from WordPress admin area. Instead, we would recommend editing your plugins in a text editor via FTP client. This way in case of an error you would be able to quickly fix it without losing access to admin area for too long.

      Administrador

  15. Mark Holland

    Thank you thank you thank you!! This has solved an issue that’s been puzzling me for weeks – and now solved in less than 1 minute.

    Can’t express how grateful I am for you sharing your knowledge – thanks again!

  16. Luca

    Thank you for the advice! But now I’m confused: what’s the difference between this method and the plugin “Code Snippet”? Is the result the same? Or do they accomplish the same thing in a different way?

  17. Malcolm

    Three years later this post is still giving – It’s changed the way I think about customising wordpress – Thank you!

    I tried this today and created a a site-specific-plugin with code to hide the wordpress menu bar for non-admins, and to add my latest post to a ‘Current issue’ menu item. Both worked perfectly.

    But the third snippet I added to the plugin failed to work. When I copied the code to the child theme’s functions.php it worked as expected.

    Can you explain why this would happen?

    I’m trying to modify the effect of the plugin “Restricted Site Access” by allowing access to more than a single page. The code I tried in my site specific plugin and the functions.php was:

    //
    add_filter( ‘restricted_site_access_is_restricted’, ‘my_restricted_check’ );
    function my_restricted_check( $is_restricted ) {
    global $wp;
    if (
    $wp->query_vars[‘pagename’] == ‘contact’ ||
    $wp->query_vars[‘pagename’] == ‘subscribe’ ||
    $wp->query_vars[‘name’] == ‘aplr-2013-volume-21-number-2’
    )
    $is_restricted = false;

    return $is_restricted;
    }

    Any advice or comment would be welcome. I’m confused!

  18. harklord

    after trying this. My site is opening blank… Please help.. Av tried deleting the files i created but still blank

  19. WPBeginner Staff

    Make sure that your stored the plugin’s php file in /wp-content/plugins/ folder and not in your theme directory.

    • Mohammed Amine

      Fixed, actually it is necessary to add that php comment in the php file, or else it wont appear on the admin panel.
      That php comment is used to show the discription of the plugin in the admin panel.

  20. Paolo Bergomi

    Hello,
    This is Paolo, i am building my website and theme with WP last edition 4.1.1.
    i Am trying to learn custom type fields and I found your website very useful. i hav ea issue, though: even if following this post i created the folder my theme plugin and with the related file .php you mentioned here, for the site specific plugin, copy all in localhost using WAMP server. i opened then my dashboard, went to plugins but my new plugin dont appear. what is going on? did i miss anything? thanks
    paolo

  21. WPBeginner Staff

    You can try and fit your modifications in site-specific plugin by using filters. However, since you had to edit specific files we doubt that all your edits can be implemented in a site-specific plugin using filters. In that case you should make those changes into a child theme. All your custom CSS should also go into your child theme’s stylesheet. You can also use your site-specific plugin to enqueue a custom stylesheet.

  22. Bas van der Linden

    Hmm, looks like my last post went missing while registering for this annoying disqus plugin.

    Anyways:
    At first I’d like to thank you for sharing this information.

    Secondly I do have several questions regarding this post.

    1) Is it possible to also make site specific plugins for other .php’s where I’ve added some codes?
    Such as front-page.php post-page.php and post-archives.php

    2) Is it possible to do something like this for .css codes?
    I run genesis as framework(Parent theme) and a child-theme that I’ve downloaded.
    Now since there are no grand-child theme’s in wordpress I’ve made my alterations in the child-theme’s folder

    This includes a lot of different .css edits, Is there a way to make site specific .css files/plugins like this, so I can maintain the origional child-theme (and perform an update if any updates are released)?

    3) When I create a site-specific plugin to change the footer and activate it, I will see both the origional footer and my own footer on the site.
    Is there a way to go around this?

    My plugin looks like this:

    Once again thank you for sharing this information on site-specific plugins, and I hope to hear soon from you guys.

  23. Chelsey

    Thank you for your patience… I’m still trying to figure out how to ‘create a new folder to plugins directory’ :-)

    • Rodney Lacambra

      Hi Chelsey. Consider this guide:

      Go to “File Manager”. It will take you to “/public_html” directory. Click on “wp-content >> plugins” . This is where you will “create” a folder called “yoursitename-plugin”. After that, create a file using some text editor(notepad++), paste the code given above and save the file as “yoursitename-plugin.php”. Upload it to “yoursitename-plugin” folder and activate it in your wordpress admin area. Easy as that!

      Hope it helps you a lot.

      Regards,
      NomadTech

      • Benjamin Mukasa

        This is a great post. I followed the instructions but the plugin is not appearing in my plugin list.

        • Paolo Bergomi

          me same..where did we make wrong? thanks in advance for any tips to solve this

  24. WPBeginner Staff

    Your code seems to be correct. Here is what you can do:

    Make sure you have saved the plugin file in the /wp-content/plugins/ directory.

    Make sure that your plugin file name is correct. We recommend using yoursitename.php format. For example if your domain name is black-circles then your plugin file name should be black-circles.php

    • SteveMTNO

      I originally had the plugin file (bc-plugin.php) in its own directory called blackcircles/wp-content/plugins/bc-plugins. That didn’t work.

      Then I tried moving the bc-plugin.php file from that folder to the blackcircles/wp-content/plugins folder. Still doesn’t show up in my admin panel.

      Do I have to “enable” it first before it shows up or something?

      Confused….

      • WPBeginner Staff

        If the file is correctly placed in your plugins folder then you will see it in your WordPress admin area under Plugins. If you see your plugin there, then you will have to click on the activate link below the file to activate the plugin.

        Did you try renaming the file to something else?

        • SteveMTNO

          Tried renaming it 3 times – none of them show up….

          I must be doing something wrong (or not doing something that I should be doing)…

        • SteveMTNO

          So can I use this one site-specific plugin for multiple functions, or is it best to do something similar to this for each one?

    • Michael Cuomo

      I’m having a similar issue with mine. I’ve created a site specific plugin to create a custom content type, but the custom content type is not showing up in my admin panel underneath pages like it should.

  25. SteveMTNO

    I posted this yesterday, but it seems to have vanished… :(

    Anyway, I followed the instructions above, but can’t see the site-specific plugin in my admin panel.

    Here’s a link to my code:

    http://pastebin.com/fbeGr8gh

  26. SteveMTNO

    I followed all of the instructions above, but my plugin doesn’t appear in my admin panel.

    Here’s my pastebin link:

    http://pastebin.com/fbeGr8gh

    Thanks!

    SteveMTNO

  27. UgochukwuEmmanuelAgbams

    i got this message while trying to install it.

    The package could not be installed. No valid plugins were found.

  28. Rajesh Ghadge

    Very useful aticle it can help any novice in the designing field thanks a million

  29. Joe Librizzi

    This is a fantastic post, thanks! Quick question – could this same method be used to modify an existing plugin, sort of like you can use a child theme to modify existing CSS? I know you can modify a plugin directly, but I’m trying to avoid losing the modifications when the plugin is updated.

    • WPBeginner Support

      Joe, yes this can be used to modify plugins. Another way to modify plugins safely is by changing their header information. You can use the header shown in the above code as an starting point.

      Administrador

  30. Correen

    Successful! Thanks for showing me how to get this accomplished.

  31. Chris

    I am new at this and learning as I go but I am confused as in the instructions both the singular and plural version of plugin was used. Am I to create one plugin file to put all snippets into or seperate plugins for each code/snippet/task?

    For example – I found this article by gooling for how to create more than one custom post type. Would I put each custom post type into a seperate plugin?

    Or could the code for custom post type go into the same plugin file as theme support for post thumbnails as I have it currently in my functions.php?

  32. Shemul

    what about custom.css? can we made something like this. it is good to have child theme then.

    • WPBeginner Support

      A child theme is always recommended but there is a fine line as to how much functionality themes should have and what functionality should fall under plugin domain.

      Administrador

  33. Sussie T

    Great article. I did this, and it was very easy. But now I am taking this further and made another file to my plugin for the site specific widgets. My first widget.
    Have fully created 2 widgets, but only the last one is showing in admin. I guess is something with hooks or register_widget, but i cant crack this one.
    Seams like an easy error to solve, if you got the experience. But for a beginner Google is not helping at all.

    Resume of my widget file:

    widget script
    widget script

    a function witch registers my 2 widgets

    Outside this function is add_action(widgets_init, name of above function)

    Please help

  34. paul

    so when i read
    Paste this code in your theme’s functions.php file or your site-specific plugin
    i just create this site-specific plugin and add code to this rather than my functions.php

  35. Duy Dang

    Thank you so much, it’s very useful!

  36. Junior Godoi

    And what about mu-plugins folder?

  37. Max

    Your site is god sent! I’ve literally been going through each of your tutorials, making a list of all the one’s I’m going to be implementing on my new site I’m developing. Some things you have covered, I would of never even have thought about, but now I am definitely dong them. Thanks for all the information you provide with your blog.

    • Editorial Staff

      Thanks a lot for the kind words Max. Let us know if you have any questions or suggestions by using our contact form.

      Administrador

  38. Hamza Aid

    I’m managing a heavy loaded WP portal, and I found many problem when performing modifications because the developer made the same mistake, and put all the code (functions, etc..) in functions.php

    Now, I re-designed the portal, and separated many functions to site specific plugins. Thanks for this great post

  39. Mattia Frigeri

    It must be said.
    This is a superlative post.

  40. Greg

    I am not sure what it is I am doing wrong. I have done exactly as you have said and I can not get it to show in my WordPress Plugins.

    I have FTP’s it in, zipped it and tried to upload it via the admin and activating it (wp actually recognized it, and when I clicked the “Activate” link …. nada. It is like it was never there and when I FTP’d back in, it wasn’t there either.

    So I am trying Brent Logan’s plugin he mentioned (Code Snippets).

    Hopefully I’ll have better luck.
    I appreciate the article though. Thanks.

    (I am not that new to this. I have played with Wordpress and Drupal and their plugins quite a bit. I am not sure why it is that I am having so much trouble with it.)

    comment would be appreciated — and I will keep reading here as well.

    • Editorial Staff

      That is actually very weird. Even when you FTP this, the file goes away from the folder?

      Administrador

  41. Brent Logan

    I was doing this until I found the Code Snippets plugin. This plugin makes it easy to add multiple snippets, with a place for easy descriptions, and then activate or deactivate the snippets individually. Quite slick.

  42. b.nijhoff

    I always thought it was really hard but after seeing this I now know I could do it to. Thanks for sharing this, all your articles have been really helpful so far. Keep on the good work!

  43. ericsavina

    What I don’t get is that I keep reading everywhere that I should modify the functions.php instead of adding plugins. It is supposed to make the site faster. So, who should I trust? The idea of having a separate file for a the changes I’m making to the funtions.php file seems very interesting. At least, I would be able to easily update my theme without having to check every time the customs changes I made.

    • CreativeBoulder

      @ericsavina From what I have been gathering, and I’ve been doing this for a good while, is that the speed and performance using a ton of PHP in your functions.php versus additional plugins that use the same code– I was not able to find much of a difference in speed. Now, anybody correct me if I am wrong and if anybody has different performance comparisons.

      At this point, I’m using my functions.php file as I outlined to keep my functions organized along with a few custom plugins that I have designed with multi-site purpose. Hope that all makes sense.

      • ericsavina

        @CreativeBoulder Thanks for your answer. I will create this plugin and check if there are any differences in loading time.

        • CreativeBoulder

          @ericsavina Not a problem. Please let me know if you find out some different results than I did? Google Chromes Web Developer Tools have been more than helpful in performance and load-time and same with http://loads.in/.

  44. CreativeBoulder

    I fully understand the reasoning behind this setup. I really like the concept. When Wordpress Upgrades, then you might need to upgrade some of your functions instead of having to navigate a possibly unorganized file structure. I was thinking about this about a week ago when working on a client site and did this with my functions.php:

    <?php

    // Require Administrator Functions/Classes

    require_once(“lib/php-classes/wp-admin-functions.php”);

    // require Custom WP Plugins (By BusinessName)

    require_once(“lib/php-classes/wp-general-functionality.php”);

    require_once(“lib/php-classes/wp-register-sidebars.php”);

    require_once(“lib/php-classes/wp-register-menus.php”);

    require_once(“lib/php-classes/wp-register-customposts.php”);

    require_once(“lib/php-classes/wp-load-jslibs.php”);

    require_once(“lib/php-classes/wp-breadcrumbs.php”);

    require_once(“lib/php-classes/wp-shortcodes.php”);

    ?>

    Which allowed me to basically work on certain aspects and know where certain custom widgets or shortcodes were instead of a huge functions.php file. What do you think? Which method works better for you?

    • affanruslan

      @CreativeBoulder No, this function.php file is within your theme file, not the core wordpress file :)

      • CreativeBoulder

        @affanruslan I fully understand what the concept here is. Thanks for the reply. The goal of creating a Site Specific Plugin is to keep your functions, widgets, short-codes (etc) separate so that they are easier to work with and more organized. My concept of using your Theme Specific functions.php and “modularizing” it into separate files is just as easy to stay organized. That’s what I was getting at. I appreciated this post. =)

  45. tomdana

    At first I was confused on what this Post was about. Once I read it I realized the usefulness of doing exactly what you suggest. I named my plugin “site-specific-functions”. Thanks for the information and all you do.

  46. tomdana

    At first I was confused on what this Post was about. Once I read it I realized the usefulness of doing exactly what you suggest. I named my plugin “site-specific-functions”. Thanks for the information and all you do.

  47. fergusonsarah

    It’s really great to read such a valuable blog post here, thanks for sharing.

Deja tu comentario

Gracias por elegir dejar un comentario. Tenga en cuenta que todos los comentarios son moderados de acuerdo con nuestros política de comentarios, y su dirección de correo electrónico NO será publicada. Por favor, NO utilice palabras clave en el campo de nombre. Tengamos una conversación personal y significativa.